kaxil commented on code in PR #71478:
URL: https://github.com/apache/airflow/pull/71478#discussion_r3963329263


##########
registry/src/_data/providerExternalServices.js:
##########
@@ -0,0 +1,43 @@
+/*!
+ * 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.
+ */
+
+// Shared by the pagefind index builder and the `externalServices` Eleventy
+// filter (used for the /providers/ filter box), so the two search paths read
+// the same field off the same shape and can't drift apart.

Review Comment:
   There's a third place doing this job: `collectSearchableValues()` in 
`providerKeywordMatch.js`, whose comment says "every string a provider is 
searchable by" and reads only the id plus integration names. The `ai-ml` 
explore category keys on `openai` and `anthropic`, so a provider that reaches 
those only through `external-services` would match the text box on /providers/ 
but not the category dropdown next to it. No behaviour change today, since 
common.ai already lands in `ai-ml` via "LangChain" and "Pydantic AI", but 
should external services feed that matcher too?



##########
registry/src/js/search.js:
##########
@@ -110,13 +111,25 @@
       const icon = type === 'provider' ? 'P' : (moduleType ? 
(typeIcons[moduleType] || moduleType[0].toUpperCase()) : 'M');
       const resultType = type === 'provider' ? 'provider' : moduleType;
 
+      // A provider often matches because of an external service its 
connections
+      // reach (e.g. "anthropic" -> Common AI), not the provider's own name --
+      // badge the specific service so that's visible instead of just the
+      // provider it lives under.
+      let matchedService = '';
+      if (type === 'provider' && currentQuery) {
+        const services = (result.meta.externalServices || 
'').split(',').filter(Boolean);
+        const normalizedQuery = currentQuery.toLowerCase();
+        matchedService = services.find((service) => 
service.toLowerCase().includes(normalizedQuery)) || '';

Review Comment:
   `find` returns the first service the query is a substring of, not the one 
that actually made pagefind match, so with Common AI's service list `ai` badges 
OpenAI and `llm` badges vLLM. It also skips the `normalize()` collapse that 
`provider-filters.js` and `providerKeywordMatch.js` both do, so `mistral-ai` 
gets no badge at all. Matching on a word start after the same normalize would 
cover both.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to