Using multiple dictionaries with Solr Suggester - configuration

I'm using the Suggester component for autocomplete. I have a variety of types of suggestions that I would like to offer, such as locations, company names, products, and dictionary words.
These lists vary in size and volatility, so keeping them all in the same text file is not the most convenient.
I'm using text files because I want the ability to add weights to the terms suggested.
Is it possible to use multiple text files? I tried the following:
<!-- WFSTLookup suggest component -->
<searchComponent class="solr.SpellCheckComponent" name="suggestword">
<lst name="spellchecker">
<str name="name">suggestword</str>
<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.fst.WFSTLookupFactory</str>
<str name="storeDir">suggestword</str>
<str name="buildOnCommit">false</str>
<!-- Suggester properties -->
<bool name="exactMatchFirst">true</bool>
<str name="sourceLocation">../data/words.txt</str>
<str name="sourceLocation">../data/cities.txt</str>
</lst>
But the second list, the cities, are apparently undetected, after restarting the tomcat and rebuilding the dictionary. Can this be done? If not, how would you recommend managing different dictionaries?

For SOLR 5.2, see Multiple Dictionaries section at https://cwiki.apache.org/confluence/display/solr/Suggester
In solrconfig.xml, define your multiple suggest dictionaries with their corresponding source files, for example:
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">words_suggester</str>
<str name="lookupImpl">FuzzyLookupFactory</str>
<str name="dictionaryImpl">FileDictionaryFactory</str>
<str name="sourceLocation">words.txt</str>
<str name="storeDir">words_dict</str>
<str name="suggestAnalyzerFieldType">string</str>
</lst>
<lst name="suggester">
<str name="name">cities_suggester</str>
<str name="lookupImpl">FuzzyLookupFactory</str>
<str name="dictionaryImpl">FileDictionaryFactory</str>
<str name="sourceLocation">cities.txt</str>
<str name="storeDir">cities_dict</str>
<str name="suggestAnalyzerFieldType">string</str>
</lst>
...
</searchComponent>
From my testing, it seems like different storeDir must be used for each FileDictionaryFactory-based suggester (otherwise they override each other).
Then, use them in the "/suggest" request handler, for example:
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
<str name="suggest.dictionary">words_suggester</str>
<str name="suggest.dictionary">cities_suggester</str>
...
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>

Related

Display HTML page in browser window upon clicking a button

I have a button on flex(AIR app). when i click on the button,has to open a browser window which will display an HTML page.
Create a URLRequest to the web page, and open it with navigateToURL :
var urlRequest:URLRequest = new URLRequest("http://www.adobe.com/");
navigateToURL(urlRequest);
Example loading a page upon click of a button with Flex MXML:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Script>
<![CDATA[
import flash.net.navigateToURL;
protected function clickHandler(event:MouseEvent):void
{
navigateToURL(new URLRequest("http://www.adobe.com"), "_blank");
}
]]>
</fx:Script>
<s:Button label="Open page"
click="clickHandler(event)" />
</s:Application>
navigateToURL():
Opens or replaces a window in the application that contains the Flash
Player container (usually a browser). In Adobe AIR, the function opens
a URL in the default system web browser.
Parameters
request:URLRequest — A URLRequest object that specifies the URL to navigate to.
For content running in Adobe AIR, when using the navigateToURL()
function, the runtime treats a URLRequest that uses the POST method
(one that has its method property set to URLRequestMethod.POST) as
using the GET method.
window:String (default = null) — The browser window or HTML frame in
which to display the document indicated by the request parameter. You
can enter the name of a specific window or use one of the following
values:
"_self" specifies the current frame in the current window.
"_blank" specifies a new window.
"_parent" specifies the parent of the current frame.
"_top" specifies the top-level frame in the current window.
urlRequest():
Creates a URLRequest object. If System.useCodePage is true, the
request is encoded using the system code page, rather than Unicode. If
System.useCodePage is false, the request is encoded using Unicode,
rather than the system code page.
Parameters
url:String (default = null) — The URL to be requested. You
can set the URL later by using the url property.

Action script mobile project. how to add datespinner

How should I add dateSpinner component to action script mobile project?
As a Flex component, DateSpinner is only available from the spark.components package; therefore, not included in pure ActionScript projects.
Implemented within the Flex framework, the spinner is rendered from Flash for ubiquitous delivery across multiple platforms.
Although there may be native extensions, AIR does not expose native controls such as UIDatePicker.
If you're using Adobe Flash Builder, instead of an ActionScript Mobile Project, you could create a Flex based application:
An example MXML implementation:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
applicationDPI="160">
<s:DateSpinner id="dateSpinner"
displayMode="dateAndTime"
selectedDate="{new Date(2013, 3, 12)}"
minDate="{new Date(2013, 0, 1)}"
maxDate="{new Date(2013, 11, 31)}"
minuteStepSize="5" />
</s:Application>
Would then produce the following:

WinRT Xaml Toolkit Bar Chart error?

Whenever I use a chart with a Line series of column series (any series other than Pie Series), I have this error:
Could not find any resources appropriate for the specified culture or
the neutral culture. Make sure
WinRTXamlToolkit.Controls.DataVisualization.Properties.Resources.resources
was correctly embedded or linked into assembly
"WinRTXamlToolkit.Controls.DataVisualization" at compile time, or that
all the satellite assemblies required are loadable and fully signed
what can be wrong here ?
here's the XAML:
<charting:Chart Name="columnChart" Grid.Row="1" Width="400" Height="400" >
<charting:Chart.Series>
<charting:ColumnSeries ItemsSource="{Binding items}"
IndependentValueBinding="{Binding Name}"
DependentValueBinding="{Binding Value}"
IsSelectionEnabled="True">
</charting:ColumnSeries>
</charting:Chart.Series>
</charting:Chart>
I had the same problem. Adding the source to my own solution did not help by itself. I did manage to fix it by changing the Build Action of the resources file to Embedded Resource.
OK
removing the references and adding again using NuGet solved the initial problem, the solution to the Column Chart in this link WinRT Xaml Toolkit Column Series Error?

instantiating a Flex app from within AS3/OpenLaszlo

I have one OpenLaszlo/AS3 App (olapp.lzx) and one Flex App (flexapp.swc).
I want to include flexapp.swc in olapp.lzx as follows:
olapp.lzx (AS3):
===============
...
var flexapp:Sprite = new FlexApp();
flexapp.doSomething();
...
The flexapp.swc is compiled from this mxml:
flexapp.mxml:
============
<?xml version="1.0"?>
<!-- intro/FlexApp.mxml -->
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<mx:ComboBox>
<mx:dataProvider>
<s:ArrayList>
<fx:String>AK</fx:String>
<fx:String>AL</fx:String>
<!-- Add all other states. -->
</s:ArrayList>
</mx:dataProvider>
</mx:ComboBox>
</mx:Application>
When I compile flexapp.mxml to swf, it runs nicely, but instantiation from AS3
fails (TypeError: Error #2007). I researched that mxml->as3 integration is not the usual way to go, but for this particular case I need to. I have to admit that I'm not yet too familiar with Flex, only OpenLaszlo. What should be changed in flexapp.mxml? Thanks!
OpenLaszlo does not officially support importing a Flash SWF application into it. The only exception are movies encoded to the SWF format.
(If your application is in Flash 9 (SWF9) or greater then the SWF movies need to be encoded in AVM2 format, for Flash 8 or lower, the AVM1 codec).
If you attempt to load a SWF that is anything other than a simple SWF movie into an OpenLaszlo <view> then the result will be unpredicatble.

Getting subchildren from FXG

I've imported an FXG from illustrator from Adobe illustrator into flash builder 4.5 and have managed to get it on the stage, the problem I'm facing is accessing the children of the FXG.
Basic FXG that won't work:
<?xml version="1.0" encoding="utf-8" ?>
<Graphic xmlns="http://ns.adobe.com/fxg/2008" xmlns:ATE="http://ns.adobe.com/ate/2009" xmlns:ai="http://ns.adobe.com/ai/2009" xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:flm="http://ns.adobe.com/flame/2008">
<Group id="subChild">
<Group id="subSubChild" />
</Group>
</Graphic>
I then try to access these children like so:
var fooObj:MyFxgObj = new MyFxgObj();
fooObj.getChildByName("subChild");
Which promptly greets me with a null error. I've searched google for the past 2 hours or so but to no avail, so any help would be appreciated.
Since you said my comment was your solution, here it is as a formal answer:
I didn't think accessing the children of an FXG graphic was possible. I think FXG assets exist at a different level than ActionScript objects or native flash objects. I view an FXG file as a single asset; kind of like a JPG or PNG or embedded SWF.
If you need to access the children, using MXML graphics is the approach you should consider.
Accessing FXG children is possible and explained in the Adobe doc Using FXG.