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
Hello all!
i have this kind of code on my project:
=======================================
string term = "word1 word2";
ISearchCriteria filter = searchCriteria
.OrderBy(new[]{"title"})
.Or().Field("title", term)
.Or().Field("summary", term)
.Or().Field("textBody", term)
.Or().NodeName(term)
.Compile();
searchProvider.Search(filter);
==============================
This returns all the contents that have "word1 word2" together.
But I need to return contents that have word1 and word2 even if they are not together or even if just one of them is found... How can I do this?
I hope I was clear about this
thanks in advance!
Pedro
You might need to stop using the fluent API and go back to using raw Lucene query syntax.
You can build a raw query something like this (where "query" is the string containing your query):
SearchProvider.Search(SearchProvider.CreateSearchCriteria().RawQuery(query));
Thanks for the reply!
Yes I was using the raw query before, but went for the "fluent" API because I needed to "boost" some fields... Can I boost field on the rawquery too?
Yeah, sure you can - see http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Boosting a Term
and you want the term "jakarta" to be more relevant boost it using the ^ symbol along with the boost factor next to the term. You would type:
jakarta^4 apache
That helps a lot! thanks
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Examine wildcard
Hello all!
i have this kind of code on my project:
=======================================
string term = "word1 word2";
ISearchCriteria filter = searchCriteria
.OrderBy(new[]{"title"})
.Or().Field("title", term)
.Or().Field("summary", term)
.Or().Field("textBody", term)
.Or().NodeName(term)
.Compile();
searchProvider.Search(filter);
==============================
This returns all the contents that have "word1 word2" together.
But I need to return contents that have word1 and word2 even if they are not together or even if just one of them is found... How can I do this?
I hope I was clear about this
thanks in advance!
Pedro
You might need to stop using the fluent API and go back to using raw Lucene query syntax.
You can build a raw query something like this (where "query" is the string containing your query):
Thanks for the reply!
Yes I was using the raw query before, but went for the "fluent" API because I needed to "boost" some fields... Can I boost field on the rawquery too?
Yeah, sure you can - see http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Boosting a Term
and you want the term "jakarta" to be more relevant boost it using the ^ symbol along with the boost factor next to the term. You would type:
That helps a lot! thanks
is working on a reply...