Solr version 6.1.0
Created a schema with some fields as indexed=true on which I specifically want the solr main-query q to search.
And also added more fields, which I just wanted to select, so marked them as stored=true and indexed=false.
Issue now is that, main query q=India is searching on non-indexed fields like country, which I have specified in the image.
See the result below
It is selecting the non-indexed field only when I specify the full value of non-indexed field.
See result for q=Indi
How can I restrict solr from searching on non-index fields?
According to the screenshot above you're copying the content sent to the field country into the field _text_. When you're not giving Solr a specific field to search (i.e. you're not using one of the dismax handlers with qf or not prefixing your term with the field name field:value), it falls back to the default search field. This is set to _text_ by default. This field is indexed, and since you're copying the content from your country field into the _text_ field, the values from country will give a hit.
If you don't want this to happen, don't copy the content from country into _text_, or give Solr the actual field you want to search.
Related
Is it possible to add fields to the schema (managed or not, does not matter) at search query time?
Basically my Solr will receive search queries for fields that I cannot anticipate. If the query contains a field that is not in the schema, i get :
"msg:undefined field"
I use Distance Function to sort results:
/select?q=city:Atlanta+_val_: dist(2,fieldX,fieldY,0,0)&fl=ticket_id,score&sort=score asc"
For example if fieldY is not in the schema, I would like Solr to give it a default value and not fail
I am indexing word document files in Apache SOLR and would like to use facets. Using Velocity, I'm able to use the facet fields and queries which appear as part of document meta data. I'm interested in using fields which are not part of Meta data as facet fields. Ex: Name is a field that does not appear in the document but I would like to use that as facet field. So what I would get is Facet field Name under which I'll have names like John, Bridget etc along with details of the number of documents in which these names (John, Bridget) appear. Please let me know if it is possible to index documents based on fields that are not part of meta data and how can the same be shown as part of facet fields.
I have a number of index fields in solr schema. Some of these are filled on regular basis on indexing content into solr. But some of these are filled conditionally such as if field name is available in source, index it and fill it in index field otherwise leave it empty.
How solr behaves in these scenarios. Do i get all fields with/without values in solr index or i will see only those index fields which are non-empty. I think later scenario should hold true.
Regards.
If the field is not marked as required then it will simply be missing from the document, and queries on those field will miss the document in question.
I am very new to solr.
Initially the "id" in my solr schema was of type string.
I have 30,000 documents, but now I want to use uuid instead of a string.
Simply changing the id to uuid and following instructions from http://wiki.apache.org/solr/UniqueKey
It did not work because it tried to string id as uuid and it failed.
My question is how do i change my id to uuid without deleting any data ?
Any info on this will be helpful.
Hope your id field is be mentioned as uniqueKey in the schema.xml. That means every solr document in your Solr instance must contain the id field. When you modify the type of any field in the schema, the previously created index for those fields get messed up. Now you can't query on those field, though they are still present in your Solr instance.
What good is that if you can not query on the data, you indexed to query? So, there is no good keeping the old document in your Solr, on which you can't query. And this time you have modified the uniqueKey field. So, you must re-index. If you would have modified the type of other field except uniqueKey, then Atomic update or partial update would have been a solution.
I have indexed a couple of documents using solr, now when I perform a search using the admin interface, it returns search results in the XML format.
I am trying to figure out how can I associate a document that I have indexed example: test.pdf with the results that I receive and then serve that document to my user ?
Will solr return to me a unique ID of the document that I index, so that after indexing a document I can store the document along with that UID in my database somewhere and then when the user performs a search solr return the unique ID's of documents that match the search criteria and then I serve them from the database
You will need to add the filename as a stored field. Look at your schema.xml and make sure you declare a field of type string and set the stored attribute to true. By setting stored=true you will ensure that Solr can return the field back in results.
See this page for more information: http://wiki.apache.org/solr/SchemaXml