Does Solr Suggester support infix search? - autocomplete

The wiki page of the Solr Suggester component does not mention how the provided field is searched? Is it a prefix only, or is there also an infix search possible?

Yes, It supported.
Edit your solrconfig.xml, go to searchComponent element, change value of "lookupImpl" from org.apache.solr.spelling.suggest.tst.TSTLookupFactory(As shown in wiki page of the Solr Suggester component example, but it can be another like FuzzyLookupFactory etc...) to AnalyzingInfixLookupFactory.
It's need to be very similar to this:
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">mySuggester</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">yourSearchFieldName</str>
<str name="suggestAnalyzerFieldType">yourSearchFieldType(String, text-general)</str>
<str name="buildOnStartup">true</str>
</lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler"
startup="lazy" >
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
Don't forget to restart your solr after changes.

You can do "infix" or n-gram style auto-suggest activity against an indexed field that has an N-Gram Tokenizer in it's analysis chain.

Related

WIX: Install Services using runner and multible dlls

I'm working on a Wix installer which should install multiple Services based on the same runner. This a some dlls which will be loaded by the runner. With sc.exe this works fine on my test system. Now my question, can I use standard Wix ServiceInstall for this? I have only one runner.exe and I'm not sure how to write this in the XML. Or would a Custom Action be the right way?
Thanks!!
The ServiceInstall and ServiceControl elements don't come after the file element per say but they are children on the Component element. They target the keypath of the component which happens to be the File element. You can easily have multiple services defined in a single component pointing to the same executable.
<Component Id="c1" Guid="dbc1b8dd-14e1-380f-5793-4a746fa0c5c5">
<File Id="f1" Source="$(var.SourceDir)\TestService.exe" KeyPath="yes" />
<ServiceInstall Id="si1" Name="TestService1" DisplayName="TestService1 Service" Description="TestService1 Service" ErrorControl="normal" Start="auto" Type="ownProcess" />
<ServiceControl Id="sc1" Name="TestService1" Start="install" Stop="both" Remove="both" Wait="yes" />
<ServiceInstall Id="si2" Name="TestService2" DisplayName="TestService2 Service" Description="TestService Service" ErrorControl="normal" Start="auto" Type="ownProcess" />
<ServiceControl Id="sc2" Name="TestService2" Start="install" Stop="both" Remove="both" Wait="yes" />
</Component>
To have each service behave differently you'll have to write code in your service to access ServiceBase.ServiceName (this.ServiceName in the OnStart method likely). From here you can dynamically load different classes from different assemblies.

How to index data from mongodb to solr 4.7

Does anyone know how to index data from mongodb into solr i've followed previous procedure which was mentioned here
can anyone give a step by step procedure to fix this issue,
here the scripts
on mydataconfig.xml
<dataConfig>
<dataSource name="MyMongo" type="MongoDataSource" database="test" />
<document name="Products">
<entity processor="MongoEntityProcessor"
query="{'Active':1}"
collection="testusers"
datasource="MyMongo"
transformer="MongoMapperTransformer" >
<field column="name" name="name" mongoField="name"/>
<field column="position" name="position" mongoField="position"/>
</entity>
</document>
and in solrconfig.xml
<lib dir="../../lib/" regex="solr-mongo-importer.jar" />
<lib dir="../../lib/" regex="mongo.jar" />
......
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">mydataconfig.xml</str>
</lst> </requestHandler>
Note: when i checked in solr\admin (in console)
GET:http://localhost:8983/solr/suggest/admin/ping?action=status&wt=json&_=1417082932028 : 503 service not available"
and in dataimport section
TypeError: $(...).attr(...) is undefined in dataimport.js
it works well for other cores i've created in same solr which connects to mysql db.

Solr returns only one collation for Suggester Component

I use solr 3.6 and I would like to use collations from suggester as a autocomplete solution for multi term searches. Unfortunately the Suggester returns only one collation for a multi term search, even if a lot of suggestions for each single term exists. Depending on my test searches and the underlying indexed data I'm sure that more collations must exist.
Is something wrong with my Suggester configuration?
<!--configuration -->
<searchComponent class="solr.SpellCheckComponent" name="suggest">
<lst name="spellchecker">
<str name="name">suggest</str>
<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.fst.WFSTLookupFactory</str>
<str name="field">text</str> <!-- the indexed field to derive suggestions from -->
<!--<float name="threshold">0.0005</float> disabled for test-->
<str name="buildOnCommit">true</str>
</lst>
</searchComponent>
<requestHandler class="org.apache.solr.handler.component.SearchHandler" name="/suggest">
<lst name="defaults">
<str name="spellcheck">true</str>
<str name="spellcheck.dictionary">suggest</str>
<str name="spellcheck.onlyMorePopular">true</str>
<str name="spellcheck.count">200</str>
<str name="spellcheck.collate">true</str>
<str name="spellcheck.maxCollations">10</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
Example response for q=bio+ber :
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">4</int>
</lst>
<lst name="spellcheck">
<lst name="suggestions">
<lst name="bio">
<int name="numFound">27</int>
<int name="startOffset">0</int>
<int name="endOffset">3</int>
<arr name="suggestion">
<str>bio</str>
<str>bio-estetica</str>
<str>bio-kosmetik</str>
...
</arr>
</lst>
<lst name="ber">
<int name="numFound">81</int>
<int name="startOffset">4</int>
<int name="endOffset">7</int>
<arr name="suggestion">
<str>beratung</str>
<str>bern</str>
...
</arr>
</lst>
<str name="collation">bio beratung</str>
</lst>
</lst>
</response>
I was having the same problem as you, and I managed to solve it. It turns out there are several things you need to know in order to get multiple collations to work properly.
First, you must specify a QueryComponent under the components list of the "suggest" requestHandler in your solrconfig.xml. Otherwise your requestHandler does not know how to query the index, so it can't figure out how many hits each corrected query has, so you'll only get one. If you had added spellcheck.collateExtendedResults=true to your query, you would have seen that the hits were 0, which shows that Solr didn't bother to check the corrected query against the index.
They hint at this with a somewhat opaque error message:
INFO: Could not find an instance of QueryComponent. Disabling collation verification against the index.
The easiest way to add it is to use the default QueryComponent, which is called "query." So in the XML you posted above, you'd change the "components" part to:
<arr name="components">
<str>suggest</str>
<str>query</str>
</arr>
Secondly, you need to set spellcheck.maxCollations to be more than 1 (duh), and less intuitively, you need to set spellcheck.maxCollationTries to be some large number (e.g. 1000). If either of these are set at the defaults (both 0), then Solr will only give you one collation. Also, you need to set spellcheck.count to be greater than 1.
Thirdly, you need to modify the query to include the field you want to search against, and the terms must be surrounded by quotes to ensure proper collation. So in the case of your query:
q=bio+ber
This really should be:
q=text:"bio+ber"
Obviously in your case, "text" is the default field, so you don't need it. But in my case, I was using a non-default field, so I had to specify it. Otherwise, Solr would count the hits against the "text" field, and all the results would have 0 hits, so the ranking would be useless.
So in my case, the query looked like this:
q=my_field:"brain+c"
&spellcheck.count=5
&spellcheck.maxCollations=10
&spellcheck.maxCollationTries=1000
&spellcheck.collateExtendedResults=true
And my response looked like this:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">4</int>
</lst>
<lst name="spellcheck">
<lst name="suggestions">
<lst name="brain">
<int name="numFound">1</int>
<int name="startOffset">15</int>
<int name="endOffset">20</int>
<arr name="suggestion">
<str>brain</str>
</arr>
</lst>
<lst name="c">
<int name="numFound">4</int>
<int name="startOffset">21</int>
<int name="endOffset">23</int>
<arr name="suggestion">
<str>cancer</str>
<str>cambrian</str>
<str>contusion</str>
<str>cells</str>
</arr>
</lst>
<lst name="collation">
<str name="collationQuery">my_field:"brain cancer"</str>
<int name="hits">2</int>
<lst name="misspellingsAndCorrections">
<str name="brain">brain</str>
<str name="c">cancer</str>
</lst>
</lst>
<lst name="collation">
<str name="collationQuery">my_field:"brain contusion"</str>
<int name="hits">1</int>
<lst name="misspellingsAndCorrections">
<str name="brain">brain</str>
<str name="c">contusion</str>
</lst>
</lst>
<lst name="collation">
<str name="collationQuery">my_field:"brain cells"</str>
<int name="hits">1</int>
<lst name="misspellingsAndCorrections">
<str name="brain">brain</str>
<str name="c">cells</str>
</lst>
</lst>
</lst>
</lst>
<result name="response" numFound="0" start="0"/>
</response>
Success!
Had the same problem.
This is a bug of Solr 3.6.1 (not sure about the previous versions). Please check: https://issues.apache.org/jira/browse/SOLR-2853.
Actually this comment puts the light: https://issues.apache.org/jira/browse/SOLR-2853?focusedCommentId=13136014&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13136014
A possible workaround is to specify spellcheck.maxCollationTries to be equal to the number of collations you need but that will also force Solr to check those collations against search index. So be careful to set this property to a big number. More on this param here: http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.maxCollationTries.
Bug is not closed but there are patches submitted already.
Also I've checked the code of Solr 4.0.0-BETA - fix is there already.
Good luck Solrs!)

Migrating WCF as Azure worker role

I have a WCF Service Library which is run as a windows service. I would like to migrate this service as Azure worker role. When I right click on a WCF project, I typically see the option "Add Windows Azure Deployment Project". With my WCF library, I do not see this option. In that case, how do I migrate the WCF service library to Azure as worker role? Any help would be greatly appreciated.
Below is the app.config for my WCF service library.
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IHealthService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" algorithmSuite="Default" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:9017/monitor/health/service.svc"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IHealthService"
contract="HealthService.IHealthService" name="NetTcpBinding_IHealthService" />
</client>
</system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
</configuration>
In this case, I would like to suggest you to manually create a worker role project, add a reference to the service library project, and then host the service inside the worker role. The service host code is similar to what you get for a normal console/Windows Service host. But please obtain the address via code. In addition, you can refer to http://msdn.microsoft.com/en-us/WAZPlatformTrainingCourse_WindowsAzureRoleCommunicationVS2010Lab for a complete tutorial.
Best Regards,
Ming Xu.
The Add Windows Azure Deployment Project option only appears if the project type is a WebApplication or WCF Application. You have to host your WCF library in a WebApplication and then the option will appear (or even better host it directly in a Windows Azure WebRole project).
If you really want to host your WCF library in a WorkerRole I suggest you do what Ming Xu has explained. But normally you host your WCF services in WebRoles on Windows Azure. So I hope you have a special need that explains why you want to use WorkerRoles.
I hope that helps.

Adquiring a SOAP trace for debugging is not woking

I am using Docusign API to create and retrieve "envelopes" for signing. (docusign.com for more info).
Basically i am having some issues trying to adquire a SOAP trace based on their instructions https://github.com/docusign/DocuSign-eSignature-SDK/wiki/How-to-acquire-a-SOAP-trace-for-debugging-%28Windows%29
And here is where i am needing some help. Has anyone, using these intructions from Docusing support (that comes from the Microsoft page and according to one Community Comments, seems not to work) been able to create a trace?
i have tried all possible combinations and i don't see no log file created so far.
I really appreciate any help you can provide me with.
Thanks
Here's the trace config I use in my App.config for DocuSign. You'll need to clean up the log a bit (look for "<<<" and ">>>" before/after each call.
First add this to the system.serviceModel section:
<diagnostics>
<messageLogging
logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true"
maxMessagesToLog="50"
maxSizeOfMessageToLog="500000000" />
</diagnostics>
Then add this to the configuration section:
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="System.Net" tracemode="protocolonly" maxdatasize="52428800" >
<listeners>
<add name="MyTraceFile"/>
</listeners>
</source>
</sources>
<sharedListeners>
<!-- Set path here. Make sure the app has permission to write to the location.-->
<add
name="MyTraceFile"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="c:\temp\DsTrace.log" />
</sharedListeners>
<switches>
<add name="System.Net" value="Verbose" />
</switches>
</system.diagnostics>
One more note, the DocuSign staff will really appreciate it if you remove the PDFBytes elements from your trace before you send it, unless that's needed for what you're having them troubleshoot.