I have implemented Solr Search and its working good to some extent. I want to implement search similar to IMDB. I have added the phonetic algorithm filter in Solr. It work for some use cases as follow
Good Use Case
Query: "Silvertor Stallon"
Result: "Slyvestor Stallone"
Query: "Angelena Jole"
Result: "Angelina Jolie"
Bad Use Case
Query: Anglina Jolie
Result: [] # Empty Array. While as I mentioned above I have Angelina Jolie in Database.
Can someone please guide me what is the problem or why Solr not finding "Anglina"
Here is my Solr configuration
<fieldType name="text" class="solr.TextField" omitNorms="false">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="20" side="front"/>
<filter class="solr.PhoneticFilterFactory" encoder="DoubleMetaphone" inject="true"/>
</analyzer>
</fieldType>
More Details:
Its a Rails project and i have used Sunspot for interaction with Solr.
Looking forward a great help. Thanks
You should really be using Solr Admin UI's Analyze screen. There, you can choose your field, put your source text and your search text and see what happens and whether they match.
In your specific case, I suspect that you cannot combine EdgeNGramFilterFactory and PhoneticFilterFactory. You will get random prefixes of text and then you try to derive phonetic information. Also, EdgeNGramFilterFactory is usually on the indexing side only and you see to be using the same definition for both indexing and query time.
Related
I want to stored a serialized data in documents with a custom field like:
<fieldType name="custom_dates" class="solr.TrieDateField" positionIncrementGap="100" multiValued="true">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<charFilter class="solr.PatternReplaceCharFilterFactory"
pattern="^.*?\|(.*)$" replacement="$1"/>
</analyzer>
</fieldType>
should index a input like birthday|2000-01-01T00:00:00Z with only regexp replacement part 2000-01-01T00:00:00Z, while stored full input value birthday|2000-01-01T00:00:00Z.
but the tokenizer is not supported under class DateField but only TextField. if I change class to TextField it can't do date operation in search query.
is there any possible to replacing index value with regexp in a non-textfield?
I'm trying to return a list of courses using an iqueryable query but am having issues with some date comparisons.
I'm currently using the code
query = query.Where(r => r.EndDate >= DateTime.UtcNow);
which returns courses with dates in the future, however it will not return courses that end on the same day with a time ending later than the time returned by DateTime.UtcNow.
Any ideas what I am doing wrong?
I've just used Luke to check the index and if I use
end_date:[20170531t092205609z TO *]
I get back the exact results I need, however in the logs the actual query uses
+end_date:[20170531t092205609z TO *] +_template:a84b75fccac64eafa746f4b71e628adc - Filter :
I then get more results back including the course I was missing.
a) Why do I get more results back using the second query?
b) Why is it that in my C# code the results returned do not match the search results?
Had a similar issue and described our solution here: https://ggullentops.blogspot.be/2015/12/sitecore-lucene-index-and-datetime.html.
Our problems had 2 reasons:
The first reason is that Sitecore stores its DateTimes in UTC (which was an hour difference with our local time)
Second reason was that Sitecore uses "t" in the dates as lowercase in the query. In my index however they are all uppercase. If I try the query with Luke it does give me the wrong results indeed.. When I alter the query in Luke to use uppercase T it works correctly..
The easiest solution we found was a format attribute in the index config:
<field fieldName="datefrom" storageType="YES" indexType="UNTOKENIZED" vectorType="NO" boost="1f"
format="yyyyMMdd" type="System.DateTime"
settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider"/>
(note the format="...")
I need to list all the files located in one document library that match a specific naming convention: The documents to retrieve are all in the form 'Report xxxx-xx-xx'.
I have to use the GetListItems web service.
Is there a way to collect all these documents in one call?
How to write the 'where' section in the query part?
Can I use some regex in this?
Thanks
Reading
http://msdn.microsoft.com/en-us/library/ms471093(v=office.12).aspx
http://msdn.microsoft.com/en-us/library/ms414805(v=office.12).aspx
the construction of a WHERE clause seems clear:
<Query>
<Where>
<Geq>
<FieldRef Name="Expires"/>
<Value Type="DateTime">
<Today/>
</Value>
</Geq>
</Where>
<OrderBy>
<FieldRef Name="Modified"/>
</OrderBy>
</Query>
However there does not seem to be a way to use regexes. Perhaps the best you can do is to use the BeginsWith element on the "Report" and Contains element to search for a dash. There is a good example for this at
http://msdn.microsoft.com/en-us/library/ms196501(v=office.12).aspx
Perhaps you could add a Calculated Column on your document library, that performs a string manipulation and/or test operation on your title text, and returns eg something that can then easily be picked up in your where clause?
This might help limit the result set at the server side...
=IF(LEFT([TitleColumn],7)="Report ", if(ISNUMBER(DATEVALUE(RIGHT([TitleColumn],10))), "TRUE", "FALSE"), "FALSE")
Refer to Microsoft's Calculated Field Formulas for what's available in calculated columns.
I need help on searching attachments i.e Word Document, PDF etc which are attached to the list during inserting Item in SharePoint 2010 using CAML queries.
I tried with this query
<Query>
<Where>
<Eq>
<FieldRef Name="Attachments" />
<Value Type="Attachments">WordDocument1.docx</Value>
</Eq>
</Where>
</Query>
im not able to get any results if i give this query.
Please help.
The problem here is that the Attachments field of a SharePoint list does not store the attachments itself. This column only return whether a certain list item has an attachment or
not.
The attachments are not stored in a SharePoint list. Therefore I don't think it's possible to retrieve them with a CAML query.
I'm trying to get data from a Sharepoint list and put it into some Flex graphs. I can call the list data just fine using a CAML query, but I want to use a GroupBy to consolidate the rows by Teams. So, for example Team 1 may have 20 records, Team 2 may have 8 records, and Team 3 might have 25 records... Instead of showing 53 records, I want to show 3... just "Team 1, Team 2, Team 3" and the sum of the cost of each entry.
I see where CAML provides a GroupBy element, but I can't seem to get it to work. Also, I was only able to get the OrderBy element to work when I used the OrderField element instead of the FieldRef element like 90% of the books and websites recommend. If I do use FieldRef, OrderBy doesn't work anymore, which makes no sense to me. Something must be awry...
Here is my CAML Query as it stands...
---------------------------------------------------
<queryRequest xmlns="http://schemas.microsoft.com/sharepoint/dsp">
<dsQuery resultContent="dataOnly" resultRoot="Rows" resultRow="Row" columnMapping="attribute">
<ViewFields>
<FieldRef Name="Team"></FieldRef>
<FieldRef Name="Cost"></FieldRef>
<FieldRef Name="EANo"></FieldRef>
</ViewFields>
<Query>
<GroupBy collapse="true">
<FieldRef Name="Team"/>
</GroupBy>
<OrderBy>
<OrderField Name="Cost"/>
</OrderBy>
</Query>
</dsQuery>
</queryRequest>
---------------------------------------------------
This is with OrderBy working, but GroupBy not working. Help!
Thanks!
I ran the following query and seems to be working fine for me.
<Query>
<GroupBy collapse="true">
<FieldRef Name='Date' />
</GroupBy>
<OrderBy>
<FieldRef Name='Title' />
</OrderBy>
</Query>
I suggest you use the U2U CAML Query Builder tool to build and test your query's