Wildcard to select all items in Solr - solr

I'm currently using Local Solr for doing geo searching. It takes in lat and long parameters as well as a search query. I want to create nearby functionality, where I don't need to provide a location and not a search query. Is there a way to provide a wildcard query that matches all elements then order by the distance? Is the best to create another field and place the same value in all fields?
Thanks.

You can use the query *:* to match all values in all fields.
See http://wiki.apache.org/solr/FAQ#How_can_I_delete_all_documents_from_my_index.3F for an example on how to query all documents using the *:* wildcard.
See also http://wiki.apache.org/solr/SolrQuerySyntax for general Solr syntax help.

You may use Solr spatial search to sort by distance, and your query can be *:* if you want to pull all documents from your index.
eg: ?q=*:*&sfield=search_field&pt=22.12,-55.56&sort=geodist() asc
http://wiki.apache.org/solr/SpatialSearch

Related

SOLR Query with multible fields to search for

i've build a query in solr that looks like this:
https://local.solr.com/solr/select?omitHeader=true&wt=json&json.nl=flat&q=*:*&fq=xtitleLow_stringS:*1002*+OR+xartnumLow_stringS:*1002*
I want to search in solr with the query "1002" for results. I didn't work it out how to search both fields with the normal query so i used the filter query.
But i can't boost the results so im kind of lost on this point. How to build this as a query so i can boost some of the fields?
thank you.
You can try with the edismax handler provided by Solr. This allows to use list of fields to query. It has option to give separate weights for each of the field for scoring them differently.
defType=edismax&q=1002&qf=xtitleLow_stringS^20 xartnumLow_stringS
The above query will search for 1002 in each of the mentioned fields.
It will be also adding a boost of 20x to any hits in the xtitleLow_stringS field.
Please find the documentation link here for more details

Sub queries with SOLR

I am trying to use subquery in SOLR (like SQL), is there a way to implement this using SOLR? to use output of one query as input to another one.
Basically want to get set of records (lets say top 300) from solr then apply some filter on the results returned.
Is there any way to implement it in SOLR?
Thanks in Advance!!!
Yes, of course. Filter queries are specifically targeted for that. Say, if a query with q=the returns you 3000 docs, you can further refine these by supplying fq=lang:en and get top 300 of the documents in English matching 'the'.

How to replicate Solr index per filter query?

I need to replicate or copy a subset of a Solr index. How might I define a filter query and replicate or copy only those documents matched by the filter query?
Thanks.
I would recommend the use of the SolrEntityProcessor that is part of the overall Solr DataImportHandler process to extract the desired subset. The SolrEntityProcessor will allow you to specify a query to execute for selecting documents and will allow you to filter as needed. You will need to use Solr 3.6 or higher to leverage the use of SolrEntityProcessor.

Apache Solr indexing and filter query

I need some information about Solr indexing I cannot find. I'm wondering whether fields on which I want to apply only a filter query have to be indexed or it is sufficient to mark them as stored.
Thanks in advance
You can refer to lucidworks solr ref guide which can be downloaded for free.
Table for field attributes and use case mapping :-
yes, it must be indexed. It does not need to be stored.
store and index are totally different concepts on Solr. If you want to make query on your fields then you should set indexed=true. If you also want to retrieve data when you query then you should set stored=true.
So, for your question; Yes you should set indexed=true if you want to make query.

How do I retrieve all applicable facet fields for a Solr search

I'm trying to use Solr for faceted-seaarch on a website.
When a user fires off a search query, I query Solr and retrieve the search results which can then be displayed.
My question is - how do I find out which facet fields and terms are applicable to the search results?
To be clear - different categories of products have different facet fields and I want to find a way to bring back the most relevant facet fields for the search results that have been returned. I don't want to have to specify the fields - I'd like Solr to identify the relevant ones for me.
Thanks in advance!
I would recommend looking over all of the Simple Facet Parameters on the Solr Wiki, especially the examples at the bottom as they will show you all of the possible ways that you can configure the faceting results for your queries.
If I am understanding your question correctly... by default faceting will only bring back facets/counts based on the documents in the result set. However to make those more relevant to the search, you should set the facet.mincount to something other than the default value of 0. eg. &facet.mincount=1. But, again please refer to the documentation on how this works and can be applied to your scenario.
Im having the same problem.
What I eventually did was to query Solr for the top 50 hits for a given query and then collect the names of the properties set on those products. I then do another query with the facet fields set to the product properties I found first time around.

Resources