Examples of RandomScoreFunction


Examples of org.elasticsearch.common.lucene.search.function.RandomScoreFunction

        }

        final FieldMapper<?> mapper = SearchContext.current().mapperService().smartNameFieldMapper("_uid");
        if (mapper == null) {
            // mapper could be null if we are on a shard with no docs yet, so this won't actually be used
            return new RandomScoreFunction();
        }

        if (seed == -1) {
            seed = Longs.hashCode(parseContext.nowInMillis());
        }
        final ShardId shardId = SearchContext.current().indexShard().shardId();
        final int salt = (shardId.index().name().hashCode() << 10) | shardId.id();
        final IndexFieldData<?> uidFieldData = SearchContext.current().fieldData().getForField(mapper);

        return new RandomScoreFunction(seed, salt, uidFieldData);
    }
View Full Code Here
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.