Commit f31ae3bf authored by Ate Douma's avatar Ate Douma

TRIVIAL cleanup master

parent 8fb0d9c4
/*.iml
/.idea
api/*.iml
api/target
commons/*.iml
commons/target
jcr/*.iml
jcr/target
sandbox/*.iml
sandbox/target
/target
This diff is collapsed.
Hippo Search Service
Copyright 2013-2018 Hippo B.V. (http://www.onehippo.com)
This product includes software developed by:
Hippo B.V., Amsterdam, The Netherlands (http://www.onehippo.com/);
The Apache Software Foundation (http://www.apache.org/).
NOTICE: Only our own original work is licensed under the terms of the
Apache License Version 2.0. The licenses of some libraries might impose
different redistribution or general licensing terms than those stated in the
Apache License. Users and redistributors are hereby requested to verify these
conditions and agree upon them.
# This is not the branch you're looking for...
BloomReach only provides the git trees for the release tags of Hippo CMS, as explained on https://www.onehippo.org/about/open-source-release-policy.html
To checkout the code for a specific release tag, after cloning this repository, use the following:
## to show the available tags
git tag
## to checkout a specific tag
git checkout <tag name>
## to modify a project
If you want to make modifications to a project, for example to create a patch, create a new fork branch from the specific tag like this:
git checkout -b forked-<tag name> <tag name>
For the latter, also see the **Build from Source** documentation at https://www.onehippo.org/library/development/build-hippo-cms-from-scratch.html
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2013-2015 Hippo B.V. (http://www.onehippo.com)
Licensed 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.
-->
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-search-service</artifactId>
<version>4.3.0-SNAPSHOT</version>
</parent>
<name>Hippo Search Service API</name>
<description>Hippo Search Service API</description>
<artifactId>hippo-search-service-api</artifactId>
<packaging>jar</packaging>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<aggregate>true</aggregate>
</configuration>
</plugin>
</plugins>
</reporting>
<build>
<defaultGoal>package</defaultGoal>
</build>
</project>
/*
* Copyright 2012-2016 Hippo B.V. (http://www.onehippo.com)
*
* Licensed 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.onehippo.cms7.services.search.content;
import java.io.Serializable;
/**
* ID representation which can provide a stringified ID.
* Also, search service implementation may require some specific
* ID representation objects implementing this interface for
* any extensible features.
*/
public interface ContentId extends Serializable {
ContentId UNKNOWN = new ContentId() {
@Override
public String toIdentifier() {
return "<unknown-content-id>";
}
};
/**
* Returns a stringified ID string
* @return
*/
String toIdentifier();
}
/*
* Copyright 2012-2016 Hippo B.V. (http://www.onehippo.com)
*
* Licensed 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.onehippo.cms7.services.search.document;
import java.util.Collection;
import org.onehippo.cms7.services.search.content.ContentId;
/**
* Representation of a document from the search engine.
*/
public interface FieldsDocument {
/**
* Return type name
* @return
*/
String getPrimaryTypeName();
/**
* Returns content ID
* @return
*/
ContentId getContentId();
/**
* Checks whether field with the name exists
* @param name
* @return
*/
boolean hasField(String name);
/**
* @return a list of fields defined in this document
*/
Collection<String> getFieldNames();
/**
* Get the value or collection of values for a given field.
*/
Object getFieldValue(String name);
/**
* Get a collection of values for a given field name
*/
Collection<Object> getFieldValues(String name);
/**
* returns the first value for a field
*/
Object getFirstFieldValue(String name);
}
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed 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.onehippo.cms7.services.search.document;
import java.util.Collection;
import java.util.Collections;
import org.onehippo.cms7.services.search.content.ContentId;
/**
* Representation of a document from the search engine.
*/
public interface SearchDocument extends FieldsDocument {
SearchDocument EMPTY = new SearchDocument() {
@Override
public String getPrimaryTypeName() {
return "nt:base";
}
@Override
public ContentId getContentId() {
return ContentId.UNKNOWN;
}
@Override
public boolean hasField(final String name) {
return false;
}
@Override
public Collection<String> getFieldNames() {
return Collections.emptyList();
}
@Override
public Object getFieldValue(final String name) {
return null;
}
@Override
public Collection<Object> getFieldValues(final String name) {
return Collections.emptyList();
}
@Override
public Object getFirstFieldValue(final String name) {
return null;
}
};
}
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed 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.onehippo.cms7.services.search.query;
import org.onehippo.cms7.services.search.query.constraint.Constraint;
public interface AndClause extends Query {
AndClause and(Constraint constraint);
}
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed 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.onehippo.cms7.services.search.query;
public interface InitialQuery extends ScopedQuery {
ScopeClause from(String path);
}
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed 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.onehippo.cms7.services.search.query;
import org.onehippo.cms7.services.search.query.constraint.Constraint;
public interface OrClause extends Query {
OrClause or(Constraint constraint);
}
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed 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.onehippo.cms7.services.search.query;
public interface OrderClause extends Query {
Query ascending();
Query descending();
}
/*
* Copyright 2012-2016 Hippo B.V. (http://www.onehippo.com)
*
* Licensed 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.onehippo.cms7.services.search.query;
public interface Query {
Query EMPTY = new EmptyQuery();
/**
* Instructs the search service to return the de-duplicated set of parent nodes of the search results. This is
* very convenient to obtain a set of all handles that have at least one variant that matches the queries
* constraints. Note that properties selected using {@link TypedQuery#select(java.lang.String)} and properties
* used for sorting using {@link #orderBy(java.lang.String)} must be at the parent's level.
*
* @return this query object
*/
Query returnParentNode();
Query offsetBy(int offset);
Query limitTo(int limit);
/**
* Instructs the search service to sort the result using the given property. See also the note at
* {@link #returnParentNode()} when used in combination with that setting.
*
* @param property name of property to sort on
* @return this query object
*/
OrderClause orderBy(String property);
}
final class EmptyQuery implements Query, OrderClause {
@Override
public Query returnParentNode() {
return this;
}
@Override
public Query offsetBy(final int offset) {
return this;
}
@Override
public Query limitTo(final int limit) {
return this;
}
@Override
public OrderClause orderBy(final String property) {
return this;
}
@Override
public Query ascending() {
return this;
}
@Override
public Query descending() {
return this;
}
}
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed 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.onehippo.cms7.services.search.query;
import org.onehippo.cms7.services.search.query.constraint.AndConstraint;
import org.onehippo.cms7.services.search.query.constraint.CompoundConstraint;
import org.onehippo.cms7.services.search.query.constraint.Constraint;
import org.onehippo.cms7.services.search.query.constraint.NotConstraint;
import org.onehippo.cms7.services.search.query.constraint.OrConstraint;
import org.onehippo.cms7.services.search.query.field.DateField;
import org.onehippo.cms7.services.search.query.field.IntegerField;
import org.onehippo.cms7.services.search.query.field.TextField;
import org.onehippo.cms7.services.search.result.QueryResult;
import org.onehippo.cms7.services.search.service.SearchService;
public abstract class QueryBuilder {
protected QueryBuilder() {
}
protected final TextField text(String property) {
return new TextField(property);
}
protected final TextField text() {
return new TextField();
}
protected final DateField date(String property) {
return new DateField(property);
}
protected final IntegerField integer(String property) {
return new IntegerField(property);
}
protected final OrConstraint either(Constraint constraint) {
return new CompoundConstraint(constraint, CompoundConstraint.Type.OR);
}
protected final AndConstraint both(Constraint constraint) {
return new CompoundConstraint(constraint, CompoundConstraint.Type.AND);
}
protected final Constraint not(Constraint constraint) {
return new NotConstraint(constraint);
}
}
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed 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.onehippo.cms7.services.search.query;
import org.onehippo.cms7.services.search.query.constraint.AndConstraint;
import org.onehippo.cms7.services.search.query.constraint.Constraint;
import org.onehippo.cms7.services.search.query.constraint.OrConstraint;
import org.onehippo.cms7.services.search.query.field.DateField;
import org.onehippo.cms7.services.search.query.field.IntegerField;
import org.onehippo.cms7.services.search.query.field.TextField;
public class QueryUtils {
private static final QueryBuilder BUILDER = new QueryBuilder() {};
private QueryUtils() {
}
public static TextField text(String property) {
return BUILDER.text(property);
}
public static TextField text() {
return BUILDER.text();
}
public static DateField date(String property) {
return BUILDER.date(property);
}
public static IntegerField integer(String property) {
return BUILDER.integer(property);
}
public static OrConstraint either(Constraint constraint) {
return BUILDER.either(constraint);
}
public static AndConstraint both(Constraint constraint) {
return BUILDER.both(constraint);
}
public static Constraint not(Constraint constraint) {
return BUILDER.not(constraint);
}
}
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed 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.onehippo.cms7.services.search.query;
public interface ScopeClause extends ScopedQuery {
ScopeClause or(String path);
ScopeClause except(String path);
}
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed 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.onehippo.cms7.services.search.query;
public interface ScopedQuery extends TypedQuery {
TypedQuery ofType(String type);
}
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed 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.onehippo.cms7.services.search.query;
import org.onehippo.cms7.services.search.query.steps.WhereStep;
public interface SelectClause extends Query, WhereStep {
SelectClause and(String property);
}
/*
* Copyright 2012-2016 Hippo B.V. (http://www.onehippo.com)
*
* Licensed 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
*
</