Examples of Lookup


Examples of org.apache.lucene.search.suggest.Lookup

    System.err.println(String.format(Locale.ENGLISH,
        "-- prefixes: %d-%d, num: %d, onlyMorePopular: %s",
        minPrefixLen, maxPrefixLen, num, onlyMorePopular));

    for (Class<? extends Lookup> cls : benchmarkClasses) {
      final Lookup lookup = buildLookup(cls, dictionaryInput);

      final List<String> input = new ArrayList<String>(benchmarkInput.size());
      for (TermFreq tf : benchmarkInput) {
        input.add(tf.term.substring(0, Math.min(tf.term.length(),
              minPrefixLen + random.nextInt(maxPrefixLen - minPrefixLen + 1))));
      }

      BenchmarkResult result = measure(new Callable<Integer>() {
        public Integer call() throws Exception {
          int v = 0;
          for (String term : input) {
            v += lookup.lookup(term, onlyMorePopular, num).size();
          }
          return v;
        }
      });

      System.err.println(
          String.format(Locale.ENGLISH, "%-15s queries: %d, time[ms]: %s, ~qps: %.0f",
              lookup.getClass().getSimpleName(),
              input.size(),
              result.average.toString(),
              input.size() / result.average.avg));
    }
  }

Examples of org.apache.lucene.search.suggest.Lookup

  private void runTest(Class<? extends Lookup> lookupClass,
      boolean supportsExactWeights) throws Exception {

    // Add all input keys.
    Lookup lookup = lookupClass.newInstance();
    Input[] keys = new Input[this.keys.length];
    for (int i = 0; i < keys.length; i++)
      keys[i] = new Input(this.keys[i], i);
    lookup.build(new InputArrayIterator(keys));

    // Store the suggester.
    File storeDir = TEMP_DIR;
    lookup.store(new FileOutputStream(new File(storeDir, "lookup.dat")));

    // Re-read it from disk.
    lookup = lookupClass.newInstance();
    lookup.load(new FileInputStream(new File(storeDir, "lookup.dat")));

    // Assert validity.
    Random random = random();
    long previous = Long.MIN_VALUE;
    for (Input k : keys) {
      List<LookupResult> list = lookup.lookup(_TestUtil.bytesToCharSequence(k.term, random), false, 1);
      assertEquals(1, list.size());
      LookupResult lookupResult = list.get(0);
      assertNotNull(k.term.utf8ToString(), lookupResult.key);

      if (supportsExactWeights) {

Examples of org.apache.lucene.search.suggest.Lookup

    System.err.println("-- construction time");
    for (final Class<? extends Lookup> cls : benchmarkClasses) {
      BenchmarkResult result = measure(new Callable<Integer>() {
        @Override
        public Integer call() throws Exception {
          final Lookup lookup = buildLookup(cls, dictionaryInput);         
          return lookup.hashCode();
        }
      });

      System.err.println(
          String.format(Locale.ROOT, "%-15s input: %d, time[ms]: %s",

Examples of org.apache.lucene.search.suggest.Lookup

   * Test memory required for the storage.
   */
  public void testStorageNeeds() throws Exception {
    System.err.println("-- RAM consumption");
    for (Class<? extends Lookup> cls : benchmarkClasses) {
      Lookup lookup = buildLookup(cls, dictionaryInput);
      long sizeInBytes = lookup.sizeInBytes();
      System.err.println(
          String.format(Locale.ROOT, "%-15s size[B]:%,13d",
              lookup.getClass().getSimpleName(),
              sizeInBytes));
    }
  }

Examples of org.apache.lucene.search.suggest.Lookup

  /**
   * Create {@link Lookup} instance and populate it.
   */
  private Lookup buildLookup(Class<? extends Lookup> cls, Input[] input) throws Exception {
    Lookup lookup = null;
    try {
      lookup = cls.newInstance();
    } catch (InstantiationException e) {
      Analyzer a = new MockAnalyzer(random, MockTokenizer.KEYWORD, false);
      if (cls == AnalyzingInfixSuggester.class) {
        lookup = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, _TestUtil.getTempDir("LookupBenchmarkTest"), a);
      } else {
        Constructor<? extends Lookup> ctor = cls.getConstructor(Analyzer.class);
        lookup = ctor.newInstance(a);
      }
    }
    lookup.build(new InputArrayIterator(input));
    return lookup;
  }

Examples of org.apache.lucene.search.suggest.Lookup

    System.err.println(String.format(Locale.ROOT,
        "-- prefixes: %d-%d, num: %d, onlyMorePopular: %s",
        minPrefixLen, maxPrefixLen, num, onlyMorePopular));

    for (Class<? extends Lookup> cls : benchmarkClasses) {
      final Lookup lookup = buildLookup(cls, dictionaryInput);

      final List<String> input = new ArrayList<String>(benchmarkInput.size());
      for (Input tf : benchmarkInput) {
        String s = tf.term.utf8ToString();
        String sub = s.substring(0, Math.min(s.length(),
            minPrefixLen + random.nextInt(maxPrefixLen - minPrefixLen + 1)));
        input.add(sub);
      }

      BenchmarkResult result = measure(new Callable<Integer>() {
        @Override
        public Integer call() throws Exception {
          int v = 0;
          for (String term : input) {
            v += lookup.lookup(term, onlyMorePopular, num).size();
          }
          return v;
        }
      });

      System.err.println(
          String.format(Locale.ROOT, "%-15s queries: %d, time[ms]: %s, ~kQPS: %.0f",
              lookup.getClass().getSimpleName(),
              input.size(),
              result.average.toString(),
              input.size() / result.average.avg));
    }
  }

Examples of org.apache.poi.ss.formula.functions.Lookup

        retval[23] = NumericFunction.LOG10;
        retval[24] = NumericFunction.ABS;
        retval[25] = NumericFunction.INT;
        retval[26] = NumericFunction.SIGN;
        retval[27] = NumericFunction.ROUND;
        retval[28] = new Lookup();
        retval[29] = new Index();
        retval[30] = new Rept();

        retval[31] = TextFunction.MID;
        retval[32] = TextFunction.LEN;

Examples of org.compiere.model.Lookup

        ArrayList<String> parentColumnNames = m_curTab.getParentColumnNames();
        for (Iterator<String> iter = parentColumnNames.iterator(); iter.hasNext();) {
          String columnName = iter.next();
          GridField field = m_curTab.getField(columnName);
          if(field.isLookup()){
            Lookup lookup = field.getLookup();
            if (lookup != null){
              displayValue = displayValue.append(lookup.getDisplay(m_curTab.getValue(i,columnName))).append(" | ");
            } else {
              displayValue = displayValue.append(m_curTab.getValue(i,columnName)).append(" | ");
            }
          } else {
            displayValue = displayValue.append(m_curTab.getValue(i,columnName)).append(" | ");

Examples of org.dynalang.dynalink.support.Lookup

        final LinkerServices ls = new LinkerServicesImpl(new TypeConverterFactory(Collections.singleton(
                new GuardingTypeConverterFactory() {
                    @Override
                    public GuardedInvocation convertToType(Class<?> sourceType, Class<?> targetType) {
                        if(targetType == int.class) {
                            return new GuardedInvocation(new Lookup(MethodHandles.publicLookup()).findVirtual(
                                    Double.class, "intValue", MethodType.methodType(int.class)).asType(
                                            MethodType.methodType(int.class, sourceType)), Guards.isOfClass(
                                                    Double.class, MethodType.methodType(boolean.class, sourceType)));
                        }
                        return null;

Examples of org.jemmy.lookup.Lookup

            return isFocused();
        }
    };

    protected Wrap<? extends TextField> getTextField() {
        Lookup lookup = as(Parent.class, Node.class).lookup(TextField.class);
        if (lookup.size() > 0) {
            Wrap<? extends TextField> inputField = as(Parent.class, Node.class).lookup(TextField.class).wrap();
            return inputField;
        }
        return null;
    }
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.