Hi :)

In schema.xml I added a custom fieldType called keyword:

<fieldType name="keyword" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.KeywordTokenizerFactory"/>
</analyzer>
</fieldType>

and a field called article :

<field name="article" type="keyword" indexed="true" stored="true"/>

Now I would like to query this field using solrj. I'm using the following code:


SolrQuery query = new SolrQuery("article:L. 111-5-2");
QueryResponse rsp = server.query(query);
list = rsp.getResults();

Even though there is only one entry in my index with the value "L. 111-5-2" in the field "article" I get a lot of results because the article value is not kept as a single token. I could change my string as "article:\\"L. 111-5-2\\"" but I was wondering if there could be any prettier way to do that (programmatically with the solrj api) ?

Gary

Reply via email to