Try our conversational search powered by Generative AI!

Only search full word using For



I am trying to search for whole word but EPiFind returns many results whereas it should only return 1 result.

the keyword is 5ianR5MTE6eMQIPw3iE1TjLqzW7No7_R

  query = query.Search(x => x.For(videoPage.LegacyVideoId, q =>
                        q.Query = "5ianR5MTE6eMQIPw3iE1TjLqzW7No7_R";
                    }).InField(a => a.LegacyVideoId));

When i change the q.Anaylzer = "keyword" as it is mentioned in elastic search but it does not return any value?

Apr 05, 2018 6:57

Hi Murtaza,

Is there a reason you need to use For()? If you're trying to get a single result based on an exact match of a query you could just use Filter(). For example:

client.Search<VideoPage>().Filter(x => x.LegacyVideoId.Match("5ianR5MTE6eMQIPw3iE1TjLqzW7No7_R"));
Apr 05, 2018 15:38

Hi @Paul Gruffydd,

The reason for using For is because property may contain some extra info for e.g

Property LegacyVideoId can contain string like 5ianR5MTE6eMQIPw3iE1TjLqzW7No7_R|112345|Axuqlap1202-T

but I need to search for string 






any of the search with above string should return back me that one result but it gives me many results.


Apr 06, 2018 2:05

Is it possible for you to change the model or change the index? My primary suggestion would be to split those values out into their own respective fields if they're supposed to be different pieces of data that should be matchable in the search. If you can't split the model by either splitting into three properties, or if that's not possible use the extension method way of adding fields to your index as explained here:

Then you can keep your model but index them in a way that makes it easier to use match as suggested by Paul above.

If none of that is an option you could also try Take(1). Unsure if it will work based on your data set but it's worth mentioning.

I'm unsure what "query" is supposed to be in your example, but using IClient you'd end up with this instead:

.For("5ianR5MTE6eMQIPw3iE1TjLqzW7No7_R", q =>
        q.Query = "5ianR5MTE6eMQIPw3iE1TjLqzW7No7_R";
.InField(a => a.LegacyVideoId)
Edited, Apr 06, 2018 22:20

Hi @Jafet Valdez

I will see if I can break propety in to multiple properties or do something mentioned in customizing serialization docs in any way i will need to re index my pages.


Apr 09, 2018 8:03

Maybe you can do like Henrik describes here:

.InField(a => a.LegacyVideoId)
Apr 09, 2018 8:53

Hi @Henrik Fransas

I checked with above suggestion it still tokenizes the string

What i have found that the following request 


gives many results

even though the Language.None is passed and LegacyVideoId$$string.standard is set as standard not as LegacyVideoId$$string.en

If I remove the .standard from the request "LegacyVideoId$$string" and re-issue it then it does whole word search which is what i want. So EPiFind has bug even we specify the Language.None it still treats as english language and tokenizes it.


Apr 10, 2018 4:24

Hi Guys,

I have used below solution to trick EPiFind to do the whole word search using wild card search

string legacyVideoId = $"*{videoPage.LegacyVideoId}*";

                    query = query.Search(x => x.For(legacyVideoId, q =>
                        q.Query = legacyVideoId;
                    }).InField(a => a.LegacyVideoId)
Apr 11, 2018 8:11
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.