Example usage for org.apache.solr.common.params SolrParams getBool

List of usage examples for org.apache.solr.common.params SolrParams getBool

Introduction

In this page you can find the example usage for org.apache.solr.common.params SolrParams getBool.

Prototype


public Boolean getBool(String param) 

Source Link

Document

Returns the Boolean value of the param, or null if not set.

Usage

From source file:org.phenotips.ontology.internal.solr.SolrQueryUtilsTest.java

License:Open Source License

@Test
public void testEnhanceParamsDefaultValues() {
    ModifiableSolrParams input = new ModifiableSolrParams();
    SolrParams output = SolrQueryUtils.enhanceParams(input);
    Assert.assertNull(output.get(CommonParams.Q));
    Assert.assertEquals("* score", output.get(CommonParams.FL));
    Assert.assertEquals(true, output.getBool(SpellingParams.SPELLCHECK_COLLATE));
    Assert.assertEquals(0, (int) output.getInt(CommonParams.START));
    Assert.assertTrue(output.getInt(CommonParams.ROWS) > 100);
}

From source file:org.phenotips.ontology.internal.solr.SolrQueryUtilsTest.java

License:Open Source License

@Test
public void testEnhanceParamsDoesntReplaceExistingValues() {
    ModifiableSolrParams input = new ModifiableSolrParams();
    input.set(CommonParams.Q, "field:value");
    input.set(CommonParams.FL, "id");
    input.set(CommonParams.START, 30);/*from www.  jav  a  2  s  .  c o  m*/
    input.set(CommonParams.ROWS, 10);
    SolrParams output = SolrQueryUtils.enhanceParams(input);
    Assert.assertEquals("field:value", output.get(CommonParams.Q));
    Assert.assertEquals("id", output.get(CommonParams.FL));
    Assert.assertEquals(true, output.getBool(SpellingParams.SPELLCHECK_COLLATE));
    Assert.assertEquals(30, (int) output.getInt(CommonParams.START));
    Assert.assertEquals(10, (int) output.getInt(CommonParams.ROWS));
}

From source file:org.tallison.solr.search.concordance.SolrConcordanceBase.java

License:Apache License

public static boolean isDistributed(SolrQueryRequest req) {
    SolrParams params = req.getParams();
    //TODO: switch to distrib? and flip bool
    Boolean localQuery = params.getBool("lq");
    if (localQuery == null)
        localQuery = false;/*from w w  w  .j a  va 2 s .com*/
    boolean isDistrib = (localQuery) ? false
            : req.getCore().getCoreDescriptor().getCoreContainer().isZooKeeperAware();
    return isDistrib;
}