| | |
| | | public class LuceneService implements Runnable {
|
| | |
|
| | |
|
| | | private static final int INDEX_VERSION = 5;
|
| | | private static final int INDEX_VERSION = 6;
|
| | |
|
| | | private static final String FIELD_OBJECT_TYPE = "type";
|
| | | private static final String FIELD_PATH = "path";
|
| | |
| | | private static final String CONF_ALIAS = "aliases";
|
| | | private static final String CONF_BRANCH = "branches";
|
| | |
|
| | | private static final Version LUCENE_VERSION = Version.LUCENE_46;
|
| | | private static final Version LUCENE_VERSION = Version.LUCENE_4_10_0;
|
| | |
|
| | | private final Logger logger = LoggerFactory.getLogger(LuceneService.class);
|
| | |
|
| | |
| | | * Synchronously indexes a repository. This may build a complete index of a
|
| | | * repository or it may update an existing index.
|
| | | *
|
| | | * @param name
|
| | | * @param displayName
|
| | | * the name of the repository
|
| | | * @param repository
|
| | | * the repository object
|
| | |
| | | // skip non-annotated tags
|
| | | continue;
|
| | | }
|
| | | if (!tags.containsKey(tag.getObjectId())) {
|
| | | if (!tags.containsKey(tag.getReferencedObjectId().getName())) {
|
| | | tags.put(tag.getReferencedObjectId().getName(), new ArrayList<String>());
|
| | | }
|
| | | tags.get(tag.getReferencedObjectId().getName()).add(tag.displayName);
|
| | |
| | | }
|
| | |
|
| | | // finished
|
| | | reader.release();
|
| | | reader.close();
|
| | |
|
| | | // commit all changes and reset the searcher
|
| | | config.setInt(CONF_INDEX, null, CONF_VERSION, INDEX_VERSION);
|
| | |
| | | // skip non-annotated tags
|
| | | continue;
|
| | | }
|
| | | if (!tags.containsKey(tag.getObjectId())) {
|
| | | if (!tags.containsKey(tag.getObjectId().getName())) {
|
| | | tags.put(tag.getReferencedObjectId().getName(), new ArrayList<String>());
|
| | | }
|
| | | tags.get(tag.getReferencedObjectId().getName()).add(tag.displayName);
|
| | |
| | | content = "";
|
| | | }
|
| | |
|
| | | int tabLength = storedSettings.getInteger(Keys.web.tabLength, 4);
|
| | | int fragmentLength = SearchObjectType.commit == result.type ? 512 : 150;
|
| | |
|
| | | QueryScorer scorer = new QueryScorer(query, "content");
|
| | |
| | | if (fragment.length() > fragmentLength) {
|
| | | fragment = fragment.substring(0, fragmentLength) + "...";
|
| | | }
|
| | | return "<pre class=\"text\">" + StringUtils.escapeForHtml(fragment, true) + "</pre>";
|
| | | return "<pre class=\"text\">" + StringUtils.escapeForHtml(fragment, true, tabLength) + "</pre>";
|
| | | }
|
| | |
|
| | | // make sure we have unique fragments
|