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.
Related
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'.
I have a problem getting the right results with my SOLR query. Basically, let's say I want all documents in English containing the string "toto".
http://127.0.0.1:8080/solr-webservice/query/?q=iso_lang_cd:en&ctnt_val:*toto*
The problem is that this query sends me all documents in English AND all documents containing toto.
What I need is to get all documents that are in English AND contain toto. How could I achieve this? I'd think this is the standard use of the AND operator...
Actually OR is the default query operator for Solr and your query is not formatted in such a away as to force an AND operation. In order to achieve the AND behavior you could specify your query in one of the following formats:
+iso_lang_cd:en +ctnt_val:*toto*
iso_lang_cd:en && ctnt_val:*toto*
Or you can optionally pass the q.op=AND to force an AND operation. Additionally, you might want to consider using Filter Queries, where you could filter on the language. There are some performance improvements with using filter queries, but please refer to the documentation for more details.
q=ctnt_val:*toto*&qf=iso_lang_cd:en
Please see The Standard Query Parser for more details and a good overview of querying.
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.
I am trying to index Wikipedia's dump. In order to provide abstract for the articles (or, maybe, enable highlighting feature in future) I'd like to store their text without WikiMarkup. For the first try, it would be enough for me to leave just alphanumeric symbols. So the question is it possible to store the field, that is filtered at character level, not the original one?
There is no way to do this out of the box. If you want Solr to do this, you can create your own UpdateHandler, but this might be a little tricky. The easiest way to do this would be to pre-process the document before sending it to Solr.
Solr by default stores original field values before the filters are been applied by the index time analyzers for your fieldType. So by default it is not storing the filtered value. However you have two options for getting the result that you want.
You can apply the same filters to the field at query time as are being applied at index time to remove the wiki markup. Please see Analyzers, Tokenizers and Token Filters on the Solr Wiki for more details.
You can apply the filters to the data in a separate process prior to loading the data into Solr, then Solr will store the filtered values, since you will be passing them in already in a filtered state.
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