I'm using Solr 3.5 in the application that I'm working currently. I have defined few field types as custom which would be a prefixed values.
Mostly they are price which differs for each and every prefix.
Example 123_34.99 will define the price "34.99" in the store "123".
I need to know whether any exact/similar Out of Box fieldtype is there in Solr 4.1.0 to handle the above mentioned field types.
I guess a better approach to store your data would be to use Solr dynamic fields. Instead of storing your data as 123_34.99, wouldn't you want to store it in a price_STOREID field like
price_123 = 34.99
Or is there a specific reason you want to store it as 123_34.99?
Related
In front i want to say that i dont have much experience with Solr.
Problem we are facing, we only want to index content of files and not want to add dynamic fields, is this possible and if so how?
Problem 2: If Problem one is a No, how would we exclude media_black_point,
media_white_point with indexing?
Error code where Solr trips:
{"responseHeader":{"status":400,"QTime":149},"error":{"metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.common.SolrException"],"msg":"incompatible dimension (2) and values (313/1000 329/1000). Only 0 values specified","code":400}}
Dynamic Fields and schemaless mode are both there to catch fields you did not declare explicitly. If neither are used, the assumption is that every field you send to Solr (including output from extract handler that generates a Solr document internally) needs to be explicitly mapped. This helps to avoid spelling errors and other unexpected edge-cases.
If you want to ignore all the fields you did not define explicitly, you can use dynamic field with stored/indexed/docValues all set to false. Solr ships with one example out of the box, you just need to uncomment it.
The other option is to ignore specific fields. You can do that by defining a custom UpdateRequestProcessor chain (or individual URP in the latest Solr) and using IgnoreFieldUpdateProcessorFactory with your specific field name or a name pattern.
One string field in Lucene/Solr is stored like this: 'yyyyMMdd'.
I need to convert the field to tdate type.
How can I achieve this and do a re-index?
If your data is coming with the incomplete date format and you want to parse it, you need to use UpdateRequestProcessor chain for that. The specific URP is ParseDateFieldUpdateProcessorFactory. It's used as part of schemaless example in Solr, so you can check its usage in the solrconfig.xml there.
Most likely, you need to re-index from the source collection. There is no rewrite in-place options in Solr for individual fields.
I'm using the Typo3 Solr Extension 2.8.3 and added some dynamic fields into the typoscripts definition.
So for example, there is a dynamic field defined for plugin.tx_solr.index.queue.tx_news.author_stringS = author
among the other typical definitons.
It seems that the dynamic fields are not put into the index automatically.
Is there a way to tell solr how to index dynamic fields too? - But using the typoscripts config ONLY. I don't like to touch the schema definition.
Did you initialize the index queue after adding your dynamic field? If so, check in your Solr Admin if the field was added and if there is any content in it.
Adding fields without changing the schema definitely works out of the box.
EDIT:
Adding fields to the Solr index doesn't mean that they are used for the search query. You must include your dynamic field also to the query using TypoScript.
See the official documentation:
http://forge.typo3.org/projects/extension-solr/wiki/Tx_solrsearch#queryfields
That should do the trick :
plugin.tx_solr.search.query.queryFields = author_stringS^10.0
I suggest you use author_textS to make it more flexible in the search. *_stringS is exact and case sensitive.
If you set queryFields don't forget to add every other fields you want to be included in the search:
plugin.tx_solr.search.query.queryFields = content^40.0, title^5.0, keywords^2.0, tagsH1^5.0, tagsH2H3^3.0, tagsH4H5H6^2.0, tagsInline^1.0, description^4.0, author_textS^10.0
I implemented Solr SpellCheck Component based on the document from http://wiki.apache.org/solr/SpellCheckComponent , it works good. But i am trying to filter the spell check result based on some other filter. Consider the following schema
product_name
product_text
product_category
product_spell -> copy string from product_name and product_text . And tokenized using white space analyzer
For the above schema, i am trying to filter the spell check result based on provided category. I tried querying like http://127.0.0.1:8080/solr/colr1/myspellcheck/?q=product_category:160%20appl&spellcheck=true&spellcheck.extendedResults=true&spellcheck.collate=true . Spellcheck results does not consider the product_category:160
Is it because the dictionary was build for all the categories? If so is it a good idea to create the dictionary for every category?
Is it not possible to have another filter condition in spellcheck component?
I am using solr 3.5
I previously understood from the SOLR-2010 issue that filtering through the fq parameter should be possible using collation, but it isn't, I think I misunderstood.
In fact, the SpellCheckComponent has most likely a separate index, except for the DirectoSolrSpellChecker implementation. It means the field you select is indexed in a different index, which contains only the information about that specific field you chose to make spelling corrections.
If you're curious, you can also have a look how that additional index looks like using luke, since it's of course a lucene index. Unfortunately filtering using other fields isn't an option there, simply because there is only one field there, the one you use to make spelling corrections.
I'm looking into using Solr for a project where we have some specific faceting requirements. From what I've learned, Solr provides range-based facets, where Solr can provide facets of different value-ranges or date-ranges, e.i. field values are "grouped" and aggregated into different bins.
I would like to do something similar, but I want to create a custom function that maps field values to my specific facets, so that each field value is evaluated using a function to see which facet it belongs to.
myFacet = myFacetMapper(fieldValue)
Its sort of a more advanced version of range-facets, but where values are mapped using a custom function rather than just into different bins.
Does anyone know if this is possible and where to start?
I would look into using SimpleFacets to implement your logic. Then you embed it inside a SearchComponent, that you can register into your solrconfig. Look at the code of FacetComponent for an example.
Create another field with value = myFacetMapper(field) , then do normal faceting on that field.