Reddit Search Query parameter - search

I am using a Reddit search query but I am facing one problem. For example a search for a query DOG is returning results with DOGS and i want the exact DOG query results. Is there any parameter that I can use in a search query to get only exact searches, not others. I am using reddit.subreddit("subreddit_name").search(query=DOG). Please guide

Related

Honoring previous searches in the next search result in solr

I am using solr for searching. I wants to improve my search result quality based on previously searched terms. Suppose, I have two products in my index with names 'Jewelry Crystal'(say it belongs to Group 1) & 'Compound Crystal'(say it belongs to Group 2). Now, if we query for 'Crystal', then both the products will come.
Let say, if I had previously searched for 'Jewelry Ornament', then I searches for 'Crystal', then I expects that only one result ('Jewelry Crystal') should come. There is no point of showing 'Compound Crystal' product to any person looking for jewelry type product.
Is there any way in SOLR to honour this kind of behavior or is there any other method to achieve this.
First of all, there's nothing built-in in Solr to achive this. What you need for this is some kind of user session, which is not supported by Solr, or a client side storage like a cookie or something for the preceding query.
But to achive the upvote you can use a runtime Boost Query.
Assuming you're using the edismax QueryParser, you can add the following to your Solr query:
q=Crystal&boost=bq:(Jewelry Ornament)
See http://wiki.apache.org/solr/ExtendedDisMax#bq_.28Boost_Query.29

Solr : Return documents that start with query keywords

I am using solr for indexing some documents and then searching. I want to return those documents that have the same start as the search keywords higher in the results. How can i achieve that?
E.g.
If i the search keyword is "php"
and there are two documents with content :
php developer
ajax php
then i want to return 'php developer' first instead of 'ajax php'.
Any suggestions on how to return results in this order?
I am looking for some sort of an analyzer that only indexes the first word from the content of a field and then giving that field a lot of weight while querying. Maybe that can help. I couldnt find such an analyzer for my purposes.
You can boost the first tokens using payload. Refer to the link mentioned in Payloads

How can I retrieve meta information about synonym matches for a Solr query?

We are using Solr to provide search functionality for our site, and I have the following requirement which has me stumped:
Given the search term "2011 Bolinger", identify that "Bollinger" (note the different spelling) is a valid value for the Producer facet, and automatically apply facet filtering for this value.
It's the fuzzy matching of the search term which I'm stuck on. Does anyone know of a way to include information in a Solr response about synonym matches which have occurred for a query during the search (i.e. a way for Solr to tell me that it saw the word 'Bollinger' in a document and recognised it as equivalent to 'Bolinger')? From what I've read so far of the Solr documentation I can't see a way to do this, but I may have missed something.

Can solr return function values (not solr score or document fields)?

We are making a solr query where we are giving a custom function (which is pretty complex) and sorting the results by value of that function. The query looks something like:
solr/select?customFunc=complexFunction(querySpecificValue1,querySpecificValue2)&sort_by=$customFunc&fq=......
Our understanding is that we can only get back fields on the document and solr score back from solr. Can someone tell us if and how we can fetch the computed value of customFunc for each document. For some reasons we cannot set solr score to be customFunc.
You should use the fl parameter to select pseudo fields, functions and so on, but this is supported only on trunk, which will be released with the 4.0 version of Solr. Have a look at the CommonQueryParameters wiki. The SOLR-2444 issue might be interesting too.
A brief example:
solr/select?q=*:*&fl=*,customFunc:complexFunction(querySpecificValue1,querySpecificValue2)
This helped me :
/solr/auction-En/select/?q=*:*_val_:"sum(x,y)"&debugQuery=true&version=2.2&start=0&rows=10&indent=on&fl=*,score
You will see the values of the function in the debug part.

Lower case and Upper case in Solr keyword

Im using Solr 3.5.0, and in Schema I have enabled the LowerCaseFilterFactory in all needed fields, bbut When I search for example "shirts" im able to get the results, also when I search for "SHIRTS" i'm able to get expected results, but when I try to search with "shiRTs" its not giving the results. I know I'm missing some thing in Schema.
Please help me on this.
Thanks
Jeyaprakash.
Apply the same analysers and filters at both index and query time, so the the queries you search for match the tokens index.
As in your case -
If you apply the Lower case filter at index time but not at query time :-
Index token will be shirts, However as the search query is not analyzed SHIRTS or even Shirts will not match indexed shirts token.
The same would apply if you are using stemmers, stopwords or other filters.
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#Analyzers
Analyzers are components that pre-process input text at index time
and/or at search time. It's important to use the same or similar
analyzers that process text in a compatible manner at index and query
time. For example, if an indexing analyzer lowercases words, then the
query analyzer should do the same to enable finding the indexed words.

Resources