Package com.flaptor.indextank.index

Examples of com.flaptor.indextank.index.DocId


                        // and check whether the keys are strings (v1) or DocIds (v2)
                        dynamicDataMap = new ConcurrentHashMap<DocId, DynamicData>();
                        boolean areDocids = keys.iterator().next() instanceof DocId;
                        for (Map.Entry<?,?> e : read.entrySet()) {
                            // convert key to docid if necessary
                            DocId docId = areDocids ? (DocId)e.getKey() : new DocId((String)e.getKey());
                            // convert value and add to the map
                            dynamicDataMap.put(docId, new DynamicData((DynamicBoosts)e.getValue()));
                        }
                    }
                    logger.info("State loaded.");
View Full Code Here


    return dynamicDataMap.get(docId);
  }
 
  @Override
  public void removeBoosts(String documentId) {
    dynamicDataMap.remove(new DocId(documentId));
  }
View Full Code Here

            data.setTimestamp(timestamp);
    }
  }

    private DynamicData getOrCreateData(String docid) {
        DocId key = new DocId(docid);
        DynamicData data = dynamicDataMap.get(key);
    if (data == null) {
      data = new DynamicData(numberOfBoosts);
     
      DynamicData previousValue = dynamicDataMap.putIfAbsent(key, data);
View Full Code Here

            if (numberOfBoosts != fileBoosts) {
                throw new IllegalStateException(String.format("Incorrect number of boosts in file. Actual: %d, Expected: %d", fileBoosts, numberOfBoosts));
            }

            while (true) {
                DocId docid = DocId.readData(dis);
                if (docid == null) {
                    break;
                }
                DynamicData data = DynamicData.readData(numberOfBoosts, dis);
                dynamicDataMap.put(docid, data);
View Full Code Here

       
        Scanner in = new Scanner(System.in);

        while (in.hasNextLine()) {
            String line = in.nextLine();
            DocId docId = new DocId(line);
            DynamicData data = ddm.getDynamicData(docId);
            System.out.println("timestamp: " + data.getTimestamp());
            for (int i = 0; i < boosts; i++) {
                System.out.println("var["+i+"]: " + data.getBoost(i));
            }
View Full Code Here

  public Iterable<ScoredMatch> decode(Iterable<RawMatch> rawMatches, final double boostedNorm) {
    try {
      final TermPositions payloads = reader.termPositions(payloadTerm);
      return Iterables.transform(rawMatches, new Function<RawMatch, ScoredMatch>() {
          private byte[] data = new byte[256];
          private ScoredMatch match = new ScoredMatch(0, new DocId(data, 0, 0));
        @Override
        public ScoredMatch apply(RawMatch rawMatch) {
          int rawId = rawMatch.getRawId();
          try {
            if (payloads.skipTo(rawId) && payloads.doc() == rawId) {
View Full Code Here

public class PayloadEncoder {

  private static final Charset UTF8 = Charset.forName("UTF-8");
 
  public static DocId decodePayloadId(final byte[] data, int size) {
    return new DocId(data, 0, size);
  }
View Full Code Here

  }
 
  public void add(String sdocid, final Document document) {
    int idx = docCount.getAndIncrement();
    if (idx < maxDocCount) {
        DocId docid = new DocId(sdocid);
      docids[idx] = docid;
      Integer oldIdx = docidsIndexes.put(docid, idx);
      if (oldIdx != null) {
        internalDel(oldIdx);
      }
View Full Code Here

      throw new IllegalStateException("MaxDocCount (" + maxDocCount + ") reached. Cannot add more documents.");
    }
  }

  public void del(String sdocid) {
      DocId docid = new DocId(sdocid);
      Integer idx = docidsIndexes.get(docid);
      if (idx != null) {
        internalDel(idx);
      } else {
        deletes.put(docid, docid);
View Full Code Here

       
        while (in.hasNextLine()) {
            String line = in.nextLine();
            if (line.startsWith("get ")) {
                String idStr = line.substring(4);
                DocId docId = new DocId(idStr);
                System.out.println(ims.getDocument(idStr));
                Boosts boosts = ddm.getBoosts(docId);
                System.out.println("timestamp: " + boosts.getTimestamp());
                for (int i = 0; i < bc; i++) {
                    System.out.println("var["+i+"]: " + boosts.getBoost(i));
View Full Code Here

TOP

Related Classes of com.flaptor.indextank.index.DocId

Copyright © 2018 www.massapicom. 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.