The easiest way to make your examples work would
be to use a copyField to an "exact match" field that
uses the KeywordTokenizer (and perhaps a lowercase filter).
Then your exact match would be satisfied by a simple
wildcard search for cat*.

You'll have to be a little careful to escape spaces for
muti-term bits, like
exact_field:pussy\ cat.
Quoting these is sometimes tricky.

Anyway, as the thread you linked to says, details matter
a lot in this case. The keyword tokenizer won't let you find
"dog has" in a field populated with "my dog has fleas" for
instance with this techinque.

As far as your question about "if" and "in", what you're probably
getting here is stopword removal, but that's a guess. Try it
again without including a stopword filter factory to test that
out.

Best,
Erick


On Sat, Sep 13, 2014 at 1:33 PM, FiMka <maximfil...@gmail.com> wrote:
> Hi guys, could you help me with implementing exact match search in Solr.
> Say I have the following Solr documents: And my search query is:
> By default Solr for the given documents and the search query "cat" will give
> all the partially matched documents ("cat", "pussy cat" and "cats"), but
> only the "cat" and "cats" results are wanted by me.
> To enable the desired Sorl search behavior, as it was suggested  here
> <http://lucene.472066.n3.nabble.com/How-to-do-exact-match-td4014264.html#a4014362>
> , I add prefixes and suffixes to phrases each time when adding new documents
> (much more details are given  here
> <http://stackoverflow.com/questions/24344740/solr-exact-match-regarding-words-number>
> ).
> I can say in most of cases (like for the above documents) this solution is
> working (we have now only "cat" and "cats" as the results for the query
> "http://localhost:8983/solr/select?q=phraseExact%3A+%22_prefix_+cat+_suffix_%22";).
> But if we have the documents like:
> If submit the search query
> "http://localhost:8983/solr/select?q=phraseExact%3A+%22_prefix_+in+case+if++_suffix_%22";,
> then all three documents are returned ("in case if", "worst-case condition",
> "optimistic-case module").
> I can suppose that such behavior can be because of preposition and
> conjunction in the searched phrase "*in* case *if*". These words possibly
> are not treated by Solr? Also it is interesting that the number of words
> (three words) in the original phrase ("in case if") matches the resulting
> phrases ("worst-case condition" and "optimistic-case module").
> Do you have some ideas why I have such results and what can be the reasons?
>
>
>
>
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/Solr-Tricky-exact-match-unwanted-search-results-tp4158652.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to