I have an index that is populated with Products. Each product has price field. I want to implement facet navigation on categories pages and i want my users to be able to search for products within a price range. At the same time, I want them to know what the minimum and maximum product price is across products in selected category. As i know Azure Search does not support min/max values in responses. So i am looking for some work around. I think that i can mark my price field as facetable and get min and max value from facet result, but default facet results count is 10, and if i understand correctly to get all prices from facet result i need to set count to Int.Max or something. That does not sound nice.
So what is the best solution to get min and max product price in specific category?
More direct approach to get the min and max product prices would be using $filter, $orderBy and $top in a Search request.
For example,
https://[service name].search.windows.net/indexes/products/docs?search=*&$filter=productName eq 'Toys'&$orderBy=price asc&$top=1.
You will need to parse the price in the response.
The approach using facet would be more expensive and, as you said, can only get you an approximation because boundaries of each facet is from pre-configured range.
Nate
Related
I have the some fields in my solr document like
default_price : 100.0,
seg_price_1 : 90.0,
seg_price_2 : 88.0,
seg_price_3 : 75.0
out of these prices i have to consider the minimum price to be given based on the segments user belong to.
for example : if user1 belongs to segment 1 and 2 then the price would be min(default_price,seg_price_1,seg_price_2)
and if user2 belongs to segments 2 and 3 then the price shown to him would be min(default_price,seg_price_2,seg_price_3)
now showing this price is not a problem neither is sorting. The problem is i want to facet based on these fields. Originally we have a field called price_range.
price_range: "100-500"
this field is a string and points to the default price. we use this field in the faceting logic to calculate the count of products belonging to each pricerange.
but now the users could be part of any combination of segments or not part any segment at all(default).
So now since price shown is dynamic based on the segments a particular user belongs to the counts based on faceting the price_range field would be wrong. Also we are getting this price_range field from another team and not a field we can afford to calculate runtime for each record for each user.
So to display the correct counts based on the dynamic prices shown to a user, what is the best way to handle this?
Please suggest.
I have a database of product information indexed by name, type, manufacturer, etc. Users often submit search queries whose results would be contained neatly in one or more facets. When this situation arises, I would like for Solr to parse the query and apply the relevant facets.
For example, searching shoes should return results in the shoe category. More ambitiously, searching plaid shirt should query plaid on items in the shirt category.
Is it possible to configure Solr to do this?
Thanks in advance.
Asking Solr to do what you want is a tall order. Your best bet would be to store categories in a field that is weighted very highly. For example, if you have a category field with the value of "shoes", having a hit on that field will increase the relevance of documents on that category, thus having them show up first. Same goes for the second example.
As for faceting, your question is not clear on how you want to apply faceting.
Suppose, I have 1000 sellers (S1.....S1000) of Apparels listed on my site. Since all the sellers are paying some amount to me, I am giving them equal weight-age, and the results are shown based on relevancy.
Now, I am planning to start with premium service, where I am thinking to list one supplier on top for each keywords in search results. Let say, S1 has been given premium search for keywords 'Jeans', so if a user searches 'jeans', I first wants to display this supplier on the top, then display other supplier based on relevancy. Plus, this premium service is for only for one month. So, another supplier say S2 can avail this service in next month and so on.
Is there any plugin, wherein I can store which supplier should be shown for which keyword. I am even OK with making 2 queries to meet the desire results.
Please suggest
I think the Query Elevation Component is your friend, you can configure which documents (and hence which suppliers) come first for any given query, see
https://wiki.apache.org/solr/QueryElevationComponent
If that's too much work, you could also add a new boolean field in your documents, indicating whether the document is to be promoted or not, and in the query, sort by this field first (so promoted documents come on top), and by score next (so most relevant documents come right after the promoted ones).
You can maybe also use the reRanking Componant :
https://cwiki.apache.org/confluence/display/solr/Query+Re-Ranking
With using a query like this :
q=jean&rq={!rerank reRankQuery=$rqq reRankDocs=1000 reRankWeight=3}&rqq=(brand:S1)
The top 1000 of results from query jean will be re-ranking thanks to the boost (of 3) add to the documents which contain the field brand with the value S1.
It can be useful, but in your case I think the QueryElevationComponent is the best.
Be careful, reRanking is only available since version 4.9.
I've recently started experimenting with Solr. My data is indexed and searchable. My problem is in the sorting. I have three fields: Author, Title, Sales.
I would like to search against the author & title fields, but have the sales value influence the score so that matches with higher sales move toward the top, even if the initial match score is not the highest.
Simply sorting by sales does not produce valid results as a result with a near 0 score for the search term, but a lot of sales in general could end up above a perfect match for the term that has never been sold.
I am seeing results that, while great term matches, are not necessarily the product I want showing at the top of the list.
If you're using the dismax handler, you can add a boost function (bf) with the field you want to boost on, e.g.
http://...?q=foo&bf="fieldValue(sales)^1.5"
...to make the value of the sales figure give a bump. You can, of course, make the function more complex if you want to munge the sales data in some way.
More info is easily found.
You may also just want to do this at index time since the sales data isn't going to be changing on the fly.
You can also use Index-time boosting.
And here's detailed info on using function queries to influence scoring.
I have a storage of news with the following fields (Title, Body, NewsDate)
I need a best query with the following criteria
1) title is more important but less than date
2) date should be compare to the current date if the date of a document is near the current date it is more valuable (NOTE: It doesn't mean that sorting descending on news date cause there maybe results that their title and its body is more relevant but its older)
this is just another factor for searching and i think it needs custom sorting
3) body has is in the third place
Any solution ?
Like #Guillaume said, you need to use boosting.
You can employ in 2 places: one while indexing (boost title and body), and second (the date field) while querying. The date-field is query-time since it is dynamic
Index time boosting would be like:
Field fld = new Field(....);
fld.setBoost(10f);//10x more important, 1 is default
Query time boost would be get the date diff (say in days or mins) and apply the boost inversely i.e. the greater the diff. the smaller the boost.
You should use Boosting in your schema, instead of very complicated queries.