Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
62 changed files
with
5,221 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea/* | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Welcome to Quaerite | ||
================================================= | ||
|
||
Background and Goals | ||
-------------------- | ||
|
||
This project includes tools to help evaluate relevance | ||
ranking. The current codebase is tightly coupled with Solr 4.x, | ||
but we plan to make this more easily extensible for more modern | ||
versions of Solr as well as Elasticsearch. | ||
|
||
This project is not intended to compete with existing relevance | ||
evaluation tools; see for example: [1] and [2]. Rather, this was developed for use cases | ||
not currently covered by other open source software packages. | ||
The author encourages collaboration among these projects. | ||
|
||
NOTE: This project is under construction and is quite dynamic. | ||
|
||
License (see also LICENSE.txt) | ||
------------------------------ | ||
|
||
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at | ||
|
||
<http://www.apache.org/licenses/LICENSE-2.0> | ||
|
||
|
||
References | ||
---------- | ||
[1]: [Quepid](https://quepid.com/) | ||
[2]: [Rated Ranking Evaluator](https://github.com/SeaseLtd/rated-ranking-evaluator/wiki/Maven-Plugin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.mitre.quaerite</groupId> | ||
<artifactId>quaerite-parent</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<relativePath>quaerite-parent/pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>quaerite</artifactId> | ||
<packaging>pom</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<solr.version>4.10.4</solr.version> | ||
</properties> | ||
|
||
<modules> | ||
<module>quaerite-parent</module> | ||
<module>quaerite-app</module> | ||
<module>quaerite-examples</module> | ||
</modules> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.mitre.quaerite</groupId> | ||
<artifactId>quaerite-parent</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<relativePath>../quaerite-parent/pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>quaerite-app</artifactId> | ||
<packaging>pom</packaging> | ||
<version>1.0.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<solr.version>4.10.4</solr.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
<version>${commons.io.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.solr</groupId> | ||
<artifactId>solr-core</artifactId> | ||
<version>${solr.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>commons-cli</groupId> | ||
<artifactId>commons-cli</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.apache.zookeeper</groupId> | ||
<artifactId>zookeeper</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.solr</groupId> | ||
<artifactId>solr-solrj</artifactId> | ||
<version>${solr.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-csv</artifactId> | ||
<version>${commons.csv.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>${commons.lang3.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-math3</artifactId> | ||
<version>3.6.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.h2database</groupId> | ||
<artifactId>h2</artifactId> | ||
<version>1.4.198</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.code.gson</groupId> | ||
<artifactId>gson</artifactId> | ||
<version>${gson.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-cli</groupId> | ||
<artifactId>commons-cli</artifactId> | ||
<version>${commons.cli.version}</version> | ||
</dependency> | ||
|
||
|
||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>2.4</version> | ||
<configuration> | ||
<finalName>quaerite</finalName> | ||
<archive> | ||
<manifest> | ||
<addClasspath>true</addClasspath> | ||
<mainClass>org.mitre.quaerite.cli.QuaeriteCLI</mainClass> --> | ||
<classpathPrefix>dependency-jars/</classpathPrefix> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.1</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>attached</goal> | ||
</goals> | ||
<phase>package</phase> | ||
<configuration> | ||
<finalName>quaerite</finalName> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
<archive> | ||
<manifest> | ||
<mainClass>QuaeriteCLI</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
117 changes: 117 additions & 0 deletions
117
quaerite-app/src/main/java/org/mitre/quaerite/Experiment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.mitre.quaerite; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import com.google.gson.Gson; | ||
|
||
public class Experiment { | ||
|
||
private static Gson GSON = new Gson(); | ||
private final String name; | ||
private final String solrUrl; | ||
private final String customHandler; | ||
Map<String, Set<String>> params = new HashMap<>(); | ||
Set<String> filterQueries = new HashSet<>(); | ||
|
||
public Experiment(String name, String solrUrl) { | ||
this(name, solrUrl, null); | ||
} | ||
public Experiment(String name, String solrUrl, String customHandler) { | ||
this.customHandler = customHandler; | ||
this.name = name; | ||
this.solrUrl = solrUrl; | ||
} | ||
|
||
public void addParam(String key, String value) { | ||
if (key.equals("q")) { | ||
throw new IllegalArgumentException("query is specified during initialization, not as a standard param!"); | ||
} | ||
if (key.equals("fq")) { | ||
throw new IllegalArgumentException("set fqs specially: setFilterQuery(fq)"); | ||
} | ||
Set<String> set = params.get(key); | ||
if (set == null) { | ||
set = new HashSet<>(); | ||
} | ||
set.add(value); | ||
params.put(key, set); | ||
} | ||
|
||
public void addFilterQuery(String fq) { | ||
if (filterQueries == null) { | ||
filterQueries = new HashSet<>(); | ||
} | ||
filterQueries.add(fq); | ||
} | ||
|
||
public Collection<String> getFilterQueries() { | ||
if (filterQueries == null) { | ||
filterQueries = new HashSet<>(); | ||
} | ||
return Collections.unmodifiableCollection(filterQueries); | ||
} | ||
|
||
public String toJson() { | ||
return GSON.toJson(this); | ||
} | ||
|
||
public Map<String, String[]> getParams() { | ||
Map<String, String[]> ret = new HashMap<>(); | ||
for (Map.Entry<String, Set<String>> e : params.entrySet()) { | ||
ret.put(e.getKey(), e.getValue().toArray(new String[e.getValue().size()])); | ||
} | ||
return ret; | ||
} | ||
|
||
public String getCustomHandler() { | ||
return customHandler; | ||
} | ||
|
||
public static Experiment fromJson(String s) { | ||
return GSON.fromJson(s, Experiment.class); | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getSolrUrl() { | ||
return solrUrl; | ||
} | ||
|
||
public Set getParams(String key) { | ||
return Collections.unmodifiableSet(params.get(key)); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Experiment{" + | ||
"name='" + name + '\'' + | ||
", solrUrl='" + solrUrl + '\'' + | ||
", customHandler='" + customHandler + '\'' + | ||
", params=" + params + | ||
", filterQueries=" + filterQueries + | ||
'}'; | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
quaerite-app/src/main/java/org/mitre/quaerite/ExperimentFeatures.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package org.mitre.quaerite; | ||
|
||
import java.io.Reader; | ||
import java.util.List; | ||
|
||
import org.mitre.quaerite.features.FeatureSet; | ||
import org.mitre.quaerite.features.PF; | ||
import org.mitre.quaerite.features.PF2; | ||
import org.mitre.quaerite.features.PF3; | ||
import org.mitre.quaerite.features.QF; | ||
import org.mitre.quaerite.features.TIE; | ||
import org.mitre.quaerite.scorecollectors.ScoreCollector; | ||
import org.mitre.quaerite.scorecollectors.ScoreCollectorListSerializer; | ||
|
||
public class ExperimentFeatures { | ||
|
||
List<ScoreCollector> scoreCollectors; | ||
List<String> solrUrls; | ||
List<String> customHandlers; | ||
QF qf; | ||
PF pf; | ||
PF2 pf2; | ||
PF3 pf3; | ||
TIE tie; | ||
|
||
public static ExperimentFeatures fromJson(Reader reader) { | ||
return ScoreCollectorListSerializer.GSON.fromJson(reader, ExperimentFeatures.class); | ||
} | ||
|
||
public List<ScoreCollector> getScoreCollectors() { | ||
return scoreCollectors; | ||
} | ||
|
||
public List<String> getSolrUrls() { | ||
return solrUrls; | ||
} | ||
|
||
public List<String> getCustomHandlers() { | ||
return customHandlers; | ||
} | ||
|
||
public QF getQf() { | ||
return qf; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ExperimentFeatures{" + | ||
"scoreCollectors=" + scoreCollectors + | ||
", solrUrls=" + solrUrls + | ||
", customHandlers=" + customHandlers + | ||
", qf=" + qf + | ||
'}'; | ||
} | ||
|
||
public FeatureSet getPF() { | ||
return (pf != null) ? pf : PF.EMPTY; | ||
} | ||
|
||
public FeatureSet getPF2() { | ||
return (pf2 != null) ? pf2 : PF2.EMPTY; | ||
} | ||
|
||
public FeatureSet getPF3() { | ||
return (pf3 != null) ? pf3 : PF3.EMPTY; | ||
} | ||
|
||
public FeatureSet getTie() { | ||
return (tie != null) ? tie : TIE.EMPTY; | ||
} | ||
} |
Oops, something went wrong.