1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
------
Searching
------
Maria Odea Ching
------
23 Nov 2007
------
~~ 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.
~~ NOTE: For help with the syntax of this file, see:
~~ http://maven.apache.org/guides/mini/guide-apt-format.html
Searching
The Search functionality of Archiva allows a user to search for specific artifact references in the repository.
* Indexing
Before artifacts can be searched in Archiva, they need to be indexed first. Aritfacts are indexed during
these instances:
* when a repository is scanned
* when an artifact is deployed or uploaded in the repository
* when an artifact is proxied or downloaded from a remote repository
[]
During repository scanning, the <<<index-content>>> consumer (see {{{../adminguide/consumers.html}Consumers}}) creates an
indexing task and queues it in an indexing task queue. This indexing task is in turn executed by a task executor and
that's where the actual indexing happens. A similar indexing task is also created and queued as artifacts are deployed
in the Archiva repository or proxied from a remote repository. The reason behind this is to avoid multiple or simultaneous
update of the index (a repository scan might be executing while artifacts are being deployed in the repository). <Note:>
This behavior applies for versions starting 1.2.1.
* What Can Be Searched?
The repository files that are indexed during repository scan can be configured in the Repository Scanning page, in the
Repository Scanning - File Types section (indexable-content). By default, the indexable-content file types are:
+-----+
**/*.txt
**/*.TXT
**/*.block
**/*.config
**/*.pom
**/*.xml
**/*.xsd
**/*.dtd
**/*.tld
+-----+
* Quick Search
The contents of all the files in the repository that matches the above configuration will be indexed during repository
scan. So when you type a word in the search box, Archiva will search the index for that query string and
return all the search hits in the form of a paginated list of artifacts.
For example you typed in 'ant', the search result would contain the list of artifacts that use or
reference 'ant'.
For query strings containing whitespaces, Archiva searches for the query string including the whitespaces.
So if you typed in 'commons logging', the search result would contain the list of artifacts that
reference 'commons logging' which is still separated by whitespace.
In this case, 'commons-logging' (hyphen separated) is not included in the search results.
Archiva can also search the index for java classes, packages, and methods and return a list of artifacts containing the
query string. In the previous versions, we need to append the keyword 'bytecode:' before the query string in the search box
(like 'bytecode:myMethod'). But since version 1.2, we no longer need to type the keyword. Just type the java class or package name
in the search box.. and voila!
The 'Search Results Only' option saves the previous search criteria and use it together with the new query string for
searching. When the user types a word in the search box, 'launcher' for example, Archiva will search the query string
from the previous list of search hits and return a new paginated list of artifacts.
Below is a sample screenshot of the search results with 'Search Results Only' option selected:
[../images/search-results.jpg] Search Results
When the user clicks a specific artifact in the search results list, Archiva will direct the user in the Artifact Info
page (the same page from the Repository Browse). Otherwise if it is not a pom file (ex. metadata.xml), the file will
appear as a file to be downloaded from the browser.
* Advanced Search
The Advanced Search feature allows user to narrow down the search by specifying the criteria such as group id,
artifact id, version, class or package, and the repository to be searched. This feature also provides the user the
option to configure the pagination of results by specifying the number of hits to be displayed in each page.
To perform an advanced search, click the <<Advanced Search \>\>>> link from Archiva's Quick Search and the Advanced Search Fields should
pop out. Select the search criteria you want to use from the Advanced Search Fields and click the + icon and for each criteria you
selected, a text field for that will be created (see the sample screenshot below). For the provided search fields, specify the term(s) for your query and click
the Search button.
[../images/advanced-search.jpg] Advanced Search screen
* Security
The Search functionality respects the repository permissions. If the user is not logged in to Archiva and does a search,
only those repositories with guest permissions will be searched for the query string. And if the user is logged in to
Archiva and does a search, only those repositories in which that user has permission to access will be searched for the
query string.
|