Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Commit

Permalink
fxed order by relevance
Browse files Browse the repository at this point in the history
  • Loading branch information
maggiolo00 authored and maggiolo00 committed May 28, 2014
1 parent f1f3fb5 commit 48ed5d9
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.orientechnologies.lucene.index;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

Expand All @@ -28,7 +29,6 @@
import com.orientechnologies.orient.core.index.OIndexMultiValues;
import com.orientechnologies.orient.core.record.impl.ODocument;


public class OLuceneFullTextIndex extends OIndexMultiValues implements OLuceneIndex {

public OLuceneFullTextIndex(String typeId, String algorithm, OLuceneIndexEngine indexEngine, String valueContainerAlgorithm,
Expand Down Expand Up @@ -75,6 +75,27 @@ public OIndexMultiValues put(Object key, OIdentifiable iSingleValue) {
}
}

@Override
public Set<OIdentifiable> get(Object key) {
checkForRebuild();

key = getCollatingValue(key);

acquireSharedLock();
try {

final Set<OIdentifiable> values = indexEngine.get(key);

if (values == null)
return Collections.emptySet();

return values;

} finally {
releaseSharedLock();
}
}

@Override
public boolean remove(Object key, OIdentifiable value) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.orientechnologies.lucene.index;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

Expand Down Expand Up @@ -70,6 +71,27 @@ public OIndexMultiValues put(Object key, OIdentifiable iSingleValue) {
}
}

@Override
public Set<OIdentifiable> get(Object key) {
checkForRebuild();

key = getCollatingValue(key);

acquireSharedLock();
try {

final Set<OIdentifiable> values = indexEngine.get(key);

if (values == null)
return Collections.emptySet();

return values;

} finally {
releaseSharedLock();
}
}

@Override
public boolean remove(Object key, OIdentifiable value) {
checkForRebuild();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
package com.orientechnologies.lucene.manager;

import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.*;

import com.orientechnologies.orient.core.index.*;
import org.apache.lucene.analysis.Analyzer;
Expand Down Expand Up @@ -126,7 +123,7 @@ public void put(Object key, Object value) {
}

private Set<OIdentifiable> getResults(Query query) {
Set<OIdentifiable> results = new HashSet<OIdentifiable>();
Set<OIdentifiable> results = new LinkedHashSet<>();
try {
IndexSearcher searcher = getSearcher();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public Object searchIntersect(OCompositeKey key, double distance, Integer limit)

double lat = ((Double) OType.convert(((OCompositeKey) key).getKeys().get(0), Double.class)).doubleValue();
double lng = ((Double) OType.convert(((OCompositeKey) key).getKeys().get(1), Double.class)).doubleValue();
Set<OIdentifiable> result = new HashSet<OIdentifiable>();
Set<OIdentifiable> result = new LinkedHashSet<>();

SpatialOperation operation = SpatialOperation.Intersects;
Point p = ctx.makePoint(lng, lat);
Expand All @@ -192,7 +192,7 @@ public Object searchIntersect(OCompositeKey key, double distance, Integer limit)

public Object searchWithin(OSpatialCompositeKey key) throws IOException {

Set<OIdentifiable> result = new HashSet<OIdentifiable>();
Set<OIdentifiable> result = new LinkedHashSet<>();

Shape shape = factory.makeShape(key, ctx);
if (shape == null)
Expand Down

0 comments on commit 48ed5d9

Please sign in to comment.