Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SearchType |
|
| 5.0;5 | ||||
SearchType$1 |
|
| 5.0;5 |
1 | package org.apache.maven.index; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one | |
5 | * or more contributor license agreements. See the NOTICE file | |
6 | * distributed with this work for additional information | |
7 | * regarding copyright ownership. The ASF licenses this file | |
8 | * to you under the Apache License, Version 2.0 (the | |
9 | * "License"); you may not use this file except in compliance | |
10 | * with the License. You may obtain a copy of the License at | |
11 | * | |
12 | * http://www.apache.org/licenses/LICENSE-2.0 | |
13 | * | |
14 | * Unless required by applicable law or agreed to in writing, | |
15 | * software distributed under the License is distributed on an | |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 | * KIND, either express or implied. See the License for the | |
18 | * specific language governing permissions and limitations | |
19 | * under the License. | |
20 | */ | |
21 | ||
22 | /** | |
23 | * Designated search types that NexusIndexer supports. | |
24 | * | |
25 | * @author cstamas | |
26 | */ | |
27 | 4 | public enum SearchType |
28 | { | |
29 | /** | |
30 | * Scored search types are usually meant for human query input, where loose-matching and result ranking is | |
31 | * happening. The order of index hits is important, since it will reflect the hits ordered by score (1st hit, best | |
32 | * match, last hit worst). | |
33 | */ | |
34 | 1 | SCORED, |
35 | ||
36 | /** | |
37 | * Exact search types are usually meant for applications filtering index content for some exact filtering condition | |
38 | * even in a "future proof" way (example with packaging "maven-archetype" vs "foo-archetype-maven"). | |
39 | */ | |
40 | 1 | EXACT; |
41 | ||
42 | public boolean matchesIndexerField( IndexerField field ) | |
43 | { | |
44 | 1 | switch ( this ) |
45 | { | |
46 | case SCORED: | |
47 | 4744 | return !field.isKeyword(); |
48 | ||
49 | case EXACT: | |
50 | 2455 | return field.isKeyword(); |
51 | ||
52 | default: | |
53 | 2 | return false; |
54 | } | |
55 | } | |
56 | } |