Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I'm trying to set up phrase search with Lucene. I'm getting nice results when searching the "nodeTitle" field.
var luceneString = "nodeTitle:" + searchTerm;
But how should I add more fields to search upon?
var luceneString = "nodeTitle: field2: field3:" + searchTerm;
Best regards David
Lucene uses a single whitespace (i.e. " ") as an "OR".
In your case it would be:
var luceneString = "nodeTitle:" + searchTerm + " field2:" + searchTerm + " field3:" + searchTerm;
This query says "find all results where nodeTitle = searchTerm OR field2 = searchTerm OR field3 = searchTerm.
It's personal preference but if you're stringing strings together then maybe use string interpolate or string.format?
E.g.
var luceneString = $"nodeTitle:{searchTerm} field2:{searchTerm} field3:{searchTerm}";
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Custom Lucene query
Hi,
I'm trying to set up phrase search with Lucene. I'm getting nice results when searching the "nodeTitle" field.
But how should I add more fields to search upon?
Best regards David
Lucene uses a single whitespace (i.e. " ") as an "OR".
In your case it would be:
This query says "find all results where nodeTitle = searchTerm OR field2 = searchTerm OR field3 = searchTerm.
It's personal preference but if you're stringing strings together then maybe use string interpolate or string.format?
E.g.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.