Extract relevant documents when search input may/may not contain white space

Hi all,
I can extract the documents with/without space. But if i give input with space (without space in index),the relevant documents are not hitting at the top. Need to score high when compared to other documents.
For eg., Index contains "tomcat", "tom cat", "bob cat", "tom fish".
when I search for "tom cat" (tokenized like "tom", "tomcat" and "cat"), it doesn't produce "tom cat" at the first.
Expected result in order: "tom cat", "tomcat", "tom fish" and "bob cat".
Help me to hit the documents with highest relevance score.

Thanks in advance.

You can combine different kind of search clauses within multiple should clauses.
Which means that the exact match will match in both cases, which means a better score.

An example of this here:

I need to search with space but the original value has no space in it. If I did this, it should return the original value at the top. I can use synonym but it is impossible to set for every values in my index.

May be ngrams would help? But more indexing time, more space on disk...
Fuzzy queries on a lowercased analyzer field?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.