Examine Lucene Search Issue and Character Stripping
I have constructed a number of indexes e.g. Standard, Whitespace etc. so that I can set up and test searches. I also have Luke running to test against them as well.
It seems like quite a simple issue. I am searching for a phrase e.g. "This is to the right" and I am using the Whitespace index.
luceneStringBodyText = "bodyText:(\"This is to the right\")";
var query = searchCriteria.RawQuery(luceneStringBodyText);
That should find every instance of "This is to the right" in any bodyText record. It does so unless the sentence in the index ends in a period/full stop i.e. "This is to the right." It does not find that phrase.
In luke, the phrase is found if my search includes the period/full stop but if I omit that, the phrase is not found.
In the second line of code above, RawQuery() changes the text and strips out the period/full stop if I put it in so there appears to be no way to construct the search phrase to include the period/full stop. RawQuery turns the above search string into: "bodyText:"? ? to ? right"" even if I include a period/fullstop after the last word i.e. "right."
Notice also that certain words are replaced by question marks/question points.
There are two questions really:
How can I set up a search to find that phrase?
Is there any way to stop RawQuery() from omitting the period/full stop if I include that at the end of the search phrase? If I can do that then I can sort this with a work around programmatically. I can live with RawQuery() changing certain words to "?" as that does not seem to affect the search.
Given that there seems to be no easy way to get around RawQuery() stripping out Lucene stop words leaving the likes of "+()" and "?", I have had to strip out those stop words from the search querystring prior to using the querystring search terms as the basis for a Lucene search.
It has been helpful to use Luke to check that the resultant Lucene search string is sound.
Examine Lucene Search Issue and Character Stripping
I have constructed a number of indexes e.g. Standard, Whitespace etc. so that I can set up and test searches. I also have Luke running to test against them as well.
It seems like quite a simple issue. I am searching for a phrase e.g. "This is to the right" and I am using the Whitespace index.
That should find every instance of "This is to the right" in any bodyText record. It does so unless the sentence in the index ends in a period/full stop i.e. "This is to the right." It does not find that phrase.
In luke, the phrase is found if my search includes the period/full stop but if I omit that, the phrase is not found.
In the second line of code above, RawQuery() changes the text and strips out the period/full stop if I put it in so there appears to be no way to construct the search phrase to include the period/full stop. RawQuery turns the above search string into: "bodyText:"? ? to ? right"" even if I include a period/fullstop after the last word i.e. "right."
Notice also that certain words are replaced by question marks/question points.
There are two questions really:
How can I set up a search to find that phrase?
Is there any way to stop RawQuery() from omitting the period/full stop if I include that at the end of the search phrase? If I can do that then I can sort this with a work around programmatically. I can live with RawQuery() changing certain words to "?" as that does not seem to affect the search.
Any help appreciated. :)
Given that there seems to be no easy way to get around RawQuery() stripping out Lucene stop words leaving the likes of "+()" and "?", I have had to strip out those stop words from the search querystring prior to using the querystring search terms as the basis for a Lucene search.
It has been helpful to use Luke to check that the resultant Lucene search string is sound.
is working on a reply...