I am on Umbraco v7.11.1.
I have successfully created three string builder objects that I have added to Examine search index. They are as follows:
(sb-title) for PDF Title /Content Page Title/Word document titles.
(sb-body) for PDF content/Content/Word document content.
(sb-metadata) for PDF description/content description/Word document content.
Note: I used the GatheringNode event handler to perform this action.
I then used "LUKE jar executable" to search content in each index and I have been able to search and get results from LUKE. All is well!
Now I am on to the search results code.
What I would like to do is add boosting 4.0 to the index sb-title field if what's being searched is found in the sb-title field.
What I would like to do is add boosting 3.0 to the index sb-body field if what's being searched is found in the sb-body field.
What I would like to do is add boosting 2.0 to the index sb-meta field if what's being searched is found in the sb-meta field.
Thanks for the link.
I am now using the Fluent API to boost.
var Searcher = ExamineManager.Instance.SearchProviderCollection[searchProvider];
var searchCriteria = Searcher.CreateSearchCriteria(BooleanOperation.Or);
var query = searchCriteria.Field("fhlb-Title", searchTerm.Boost(5)).Or().Field("fhlb-Body", searchTerm.Boost(3)).Or().Field("fhlb-Metadata", searchTerm.Boost(2)).Compile();
var searchResults = Searcher.Search(query);
searchResults now contains the results "boosted".
Note: For my implementation I have 3 buckets to hold my search results ("fhlb-Title", fhlb-Body" and fhlb-Metaqdata")
But now I need additional help in returning the results to the User Interface and in highlighting what's searched.
Do you have an extended example that will highlight searched text and also show a 2-3 line headline of each search result?
Examine Boosting
Hello:
I am on Umbraco v7.11.1. I have successfully created three string builder objects that I have added to Examine search index. They are as follows: (sb-title) for PDF Title /Content Page Title/Word document titles.
(sb-body) for PDF content/Content/Word document content. (sb-metadata) for PDF description/content description/Word document content. Note: I used the GatheringNode event handler to perform this action.
I then used "LUKE jar executable" to search content in each index and I have been able to search and get results from LUKE. All is well!
Now I am on to the search results code.
What I would like to do is add boosting 4.0 to the index sb-title field if what's being searched is found in the sb-title field.
What I would like to do is add boosting 3.0 to the index sb-body field if what's being searched is found in the sb-body field.
What I would like to do is add boosting 2.0 to the index sb-meta field if what's being searched is found in the sb-meta field.
Does anyone have an example of how to do this?
Thanks
BTD
Have a look at this blogpost: https://umbraco.com/blog/examining-examine/
Basically you use
Boost
in the Fluent APIThank you so much for your reply.
Tom
Seren:
Thanks for the link.
I am now using the Fluent API to boost.
var searchResults = Searcher.Search(query);
searchResults now contains the results "boosted". Note: For my implementation I have 3 buckets to hold my search results ("fhlb-Title", fhlb-Body" and fhlb-Metaqdata")
But now I need additional help in returning the results to the User Interface and in highlighting what's searched.
Do you have an extended example that will highlight searched text and also show a 2-3 line headline of each search result?
Thanks
Tom
PS I verified my searching is working using LUKE.
If you need more code, let me know and I can post my code process.
Thanks Tom
is working on a reply...