@@ -190,87 +190,6 @@ impl SearchIndex {
190190 . push ( entry) ;
191191 }
192192
193- /// Add a package to the index
194- fn add_package ( & mut self , package : & PackageInfo , contents : Option < & PackageContents > ) {
195- // Get the FMRI as a string
196- let fmri = package. fmri . to_string ( ) ;
197- let stem = package. fmri . stem ( ) ;
198-
199- // Add package mapping
200- self . packages . insert ( fmri. clone ( ) , stem. to_string ( ) ) ;
201-
202- // 1. Index package stem (action=pkg, index=name)
203- // Note: Legacy pkg search often uses 'set' action for package attributes, but let's use what we have.
204- // Actually man page says `pkg_name` is implicit.
205- // Let's index it as: action="pkg", index="name", value=stem
206- self . add_term ( stem, & fmri, "pkg" , "name" , stem, None ) ;
207-
208- // Also index parts of the stem if it contains '/'?
209- // Legacy behavior might index tokens.
210- for part in stem. split ( '/' ) {
211- if part != stem {
212- self . add_term ( part, & fmri, "pkg" , "name" , stem, None ) ;
213- }
214- }
215-
216- // 2. Index Publisher (action=pkg, index=publisher)
217- if let Some ( publisher) = & package. fmri . publisher {
218- self . add_term ( publisher, & fmri, "pkg" , "publisher" , publisher, None ) ;
219- }
220-
221- // 3. Index Version (action=pkg, index=version)
222- let version = package. fmri . version ( ) ;
223- if !version. is_empty ( ) {
224- self . add_term ( & version, & fmri, "pkg" , "version" , & version, None ) ;
225- }
226-
227- // 4. Index Contents
228- if let Some ( content) = contents {
229- // Add files
230- if let Some ( files) = & content. files {
231- for file in files {
232- // index=path
233- self . add_term ( file, & fmri, "file" , "path" , file, None ) ;
234- // index=basename
235- if let Some ( basename) = Path :: new ( file) . file_name ( ) . and_then ( |s| s. to_str ( ) ) {
236- self . add_term ( basename, & fmri, "file" , "basename" , file, None ) ;
237- }
238- }
239- }
240-
241- // Add directories
242- if let Some ( directories) = & content. directories {
243- for dir in directories {
244- // index=path
245- self . add_term ( dir, & fmri, "dir" , "path" , dir, None ) ;
246- // index=basename
247- if let Some ( basename) = Path :: new ( dir) . file_name ( ) . and_then ( |s| s. to_str ( ) ) {
248- self . add_term ( basename, & fmri, "dir" , "basename" , dir, None ) ;
249- }
250- }
251- }
252-
253- // Add dependencies
254- if let Some ( dependencies) = & content. dependencies {
255- for dep in dependencies {
256- // dep is an FMRI string usually.
257- // index=fmri, value=dep
258- self . add_term ( dep, & fmri, "depend" , "fmri" , dep, None ) ;
259- // maybe parse stem from dep fmri?
260- if let Ok ( dep_fmri) = Fmri :: parse ( dep) {
261- self . add_term ( dep_fmri. stem ( ) , & fmri, "depend" , "fmri" , dep, None ) ;
262- }
263- }
264- }
265- }
266-
267- // Update the timestamp
268- self . updated = SystemTime :: now ( )
269- . duration_since ( UNIX_EPOCH )
270- . unwrap_or_default ( )
271- . as_secs ( ) ;
272- }
273-
274193 /// Search the index for packages matching a query
275194 fn search ( & self , query : & str , case_sensitive : bool , limit : Option < usize > ) -> Vec < IndexEntry > {
276195 // Split the query into terms (whitespace)
0 commit comments